stream_topic: Refactor user_ids_muting_topic.

This refactors and renames user_ids_muting_topic to accept a parameter
'visibility_policy' and fetch user IDs that have a specific
visibility_policy(provided as the parameter) set for a topic.
This commit is contained in:
Kartik Srivastava
2022-09-12 17:44:24 +05:30
committed by Tim Abbott
parent 8eec4bf171
commit 409ef040bb
3 changed files with 7 additions and 6 deletions

View File

@@ -15,11 +15,11 @@ class StreamTopicTarget:
self.stream_id = stream_id
self.topic_name = topic_name
def user_ids_muting_topic(self) -> Set[int]:
def user_ids_with_visibility_policy(self, visibility_policy: int) -> Set[int]:
query = UserTopic.objects.filter(
stream_id=self.stream_id,
topic_name__iexact=self.topic_name,
visibility_policy=UserTopic.MUTED,
visibility_policy=visibility_policy,
).values(
"user_profile_id",
)