mirror of https://github.com/zulip/zulip.git
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:
parent
e33eb45507
commit
0b2fe5b163
|
@ -491,7 +491,7 @@ def access_web_public_stream(stream_id: int, realm: Realm) -> Stream:
|
||||||
return 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
|
user_profile: UserProfile, stream_name: str, error: str
|
||||||
) -> Stream:
|
) -> Stream:
|
||||||
"""
|
"""
|
||||||
|
@ -514,7 +514,7 @@ def access_stream_for_unmute_topic_by_name(
|
||||||
return stream
|
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
|
user_profile: UserProfile, stream_id: int, error: str
|
||||||
) -> Stream:
|
) -> Stream:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -11,8 +11,8 @@ from zerver.lib.response import json_success
|
||||||
from zerver.lib.streams import (
|
from zerver.lib.streams import (
|
||||||
access_stream_by_id,
|
access_stream_by_id,
|
||||||
access_stream_by_name,
|
access_stream_by_name,
|
||||||
access_stream_for_unmute_topic_by_id,
|
access_stream_to_remove_visibility_policy_by_id,
|
||||||
access_stream_for_unmute_topic_by_name,
|
access_stream_to_remove_visibility_policy_by_name,
|
||||||
check_for_exactly_one_stream_arg,
|
check_for_exactly_one_stream_arg,
|
||||||
)
|
)
|
||||||
from zerver.lib.validator import check_int, check_string_in
|
from zerver.lib.validator import check_int, check_string_in
|
||||||
|
@ -50,10 +50,10 @@ def unmute_topic(
|
||||||
error = _("Topic is not muted")
|
error = _("Topic is not muted")
|
||||||
|
|
||||||
if stream_name is not None:
|
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:
|
else:
|
||||||
assert stream_id is not None
|
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(
|
do_set_user_topic_visibility_policy(
|
||||||
user_profile, stream, topic_name, visibility_policy=UserTopic.VisibilityPolicy.INHERIT
|
user_profile, stream, topic_name, visibility_policy=UserTopic.VisibilityPolicy.INHERIT
|
||||||
|
|
Loading…
Reference in New Issue