user_topics: Rename the 'zerver/lib/user_topics' functions.

This is a prep commit that renames lib functions
so that they can be used while implementing view
for the new endpoint 'POST /user_topics'.

We use a more generic name when removing the visibility_policy of
a topic, i.e., 'access_stream_to_remove_visibility_policy_by_id/name'
instead of 'access_stream_for_unmute_topic_by_id/name' which focused
on removing MUTE from a topic.
This commit is contained in:
Prakhar Pratyush 2023-04-03 12:54:30 +05:30 committed by Tim Abbott
parent e33eb45507
commit 0b2fe5b163
2 changed files with 6 additions and 6 deletions

View File

@ -491,7 +491,7 @@ def access_web_public_stream(stream_id: int, realm: Realm) -> Stream:
return stream
def access_stream_for_unmute_topic_by_name(
def access_stream_to_remove_visibility_policy_by_name(
user_profile: UserProfile, stream_name: str, error: str
) -> Stream:
"""
@ -514,7 +514,7 @@ def access_stream_for_unmute_topic_by_name(
return stream
def access_stream_for_unmute_topic_by_id(
def access_stream_to_remove_visibility_policy_by_id(
user_profile: UserProfile, stream_id: int, error: str
) -> Stream:
try:

View File

@ -11,8 +11,8 @@ from zerver.lib.response import json_success
from zerver.lib.streams import (
access_stream_by_id,
access_stream_by_name,
access_stream_for_unmute_topic_by_id,
access_stream_for_unmute_topic_by_name,
access_stream_to_remove_visibility_policy_by_id,
access_stream_to_remove_visibility_policy_by_name,
check_for_exactly_one_stream_arg,
)
from zerver.lib.validator import check_int, check_string_in
@ -50,10 +50,10 @@ def unmute_topic(
error = _("Topic is not muted")
if stream_name is not None:
stream = access_stream_for_unmute_topic_by_name(user_profile, stream_name, error)
stream = access_stream_to_remove_visibility_policy_by_name(user_profile, stream_name, error)
else:
assert stream_id is not None
stream = access_stream_for_unmute_topic_by_id(user_profile, stream_id, error)
stream = access_stream_to_remove_visibility_policy_by_id(user_profile, stream_id, error)
do_set_user_topic_visibility_policy(
user_profile, stream, topic_name, visibility_policy=UserTopic.VisibilityPolicy.INHERIT