mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
streams: Remove require_active in access_stream code path.
This was confusingly doing an assertion about the subscription being active, not the channel. We could rename it to require_active_subscription. But it was only passed with a non-default value inb2cb443d24
, and that call was removed in378062cc83
.
This commit is contained in:
@@ -185,7 +185,6 @@ def get_chart_data_for_stream(
|
|||||||
stream, ignored_sub = access_stream_by_id(
|
stream, ignored_sub = access_stream_by_id(
|
||||||
user_profile,
|
user_profile,
|
||||||
stream_id,
|
stream_id,
|
||||||
require_active=True,
|
|
||||||
require_content_access=False,
|
require_content_access=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -1339,9 +1339,7 @@ def build_message_edit_request(
|
|||||||
is_stream_edited = False
|
is_stream_edited = False
|
||||||
target_stream = orig_stream
|
target_stream = orig_stream
|
||||||
if stream_id is not None:
|
if stream_id is not None:
|
||||||
target_stream = access_stream_by_id_for_message(
|
target_stream = access_stream_by_id_for_message(user_profile, stream_id)[0]
|
||||||
user_profile, stream_id, require_active=True
|
|
||||||
)[0]
|
|
||||||
is_stream_edited = True
|
is_stream_edited = True
|
||||||
|
|
||||||
return StreamMessageEditRequest(
|
return StreamMessageEditRequest(
|
||||||
|
@@ -765,7 +765,6 @@ def access_stream_common(
|
|||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
stream: Stream,
|
stream: Stream,
|
||||||
error: str,
|
error: str,
|
||||||
require_active: bool = True,
|
|
||||||
require_content_access: bool = True,
|
require_content_access: bool = True,
|
||||||
) -> Subscription | None:
|
) -> Subscription | None:
|
||||||
"""Common function for backend code where the target use attempts to
|
"""Common function for backend code where the target use attempts to
|
||||||
@@ -782,7 +781,7 @@ def access_stream_common(
|
|||||||
try:
|
try:
|
||||||
assert stream.recipient_id is not None
|
assert stream.recipient_id is not None
|
||||||
sub = Subscription.objects.get(
|
sub = Subscription.objects.get(
|
||||||
user_profile=user_profile, recipient_id=stream.recipient_id, active=require_active
|
user_profile=user_profile, recipient_id=stream.recipient_id, active=True
|
||||||
)
|
)
|
||||||
except Subscription.DoesNotExist:
|
except Subscription.DoesNotExist:
|
||||||
sub = None
|
sub = None
|
||||||
@@ -803,7 +802,6 @@ def access_stream_common(
|
|||||||
def access_stream_by_id(
|
def access_stream_by_id(
|
||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
stream_id: int,
|
stream_id: int,
|
||||||
require_active: bool = True,
|
|
||||||
require_content_access: bool = True,
|
require_content_access: bool = True,
|
||||||
) -> tuple[Stream, Subscription | None]:
|
) -> tuple[Stream, Subscription | None]:
|
||||||
error = _("Invalid channel ID")
|
error = _("Invalid channel ID")
|
||||||
@@ -816,7 +814,6 @@ def access_stream_by_id(
|
|||||||
user_profile,
|
user_profile,
|
||||||
stream,
|
stream,
|
||||||
error,
|
error,
|
||||||
require_active=require_active,
|
|
||||||
require_content_access=require_content_access,
|
require_content_access=require_content_access,
|
||||||
)
|
)
|
||||||
return (stream, sub)
|
return (stream, sub)
|
||||||
@@ -825,7 +822,6 @@ def access_stream_by_id(
|
|||||||
def access_stream_by_id_for_message(
|
def access_stream_by_id_for_message(
|
||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
stream_id: int,
|
stream_id: int,
|
||||||
require_active: bool = True,
|
|
||||||
require_content_access: bool = True,
|
require_content_access: bool = True,
|
||||||
) -> tuple[Stream, Subscription | None]:
|
) -> tuple[Stream, Subscription | None]:
|
||||||
"""
|
"""
|
||||||
@@ -842,7 +838,6 @@ def access_stream_by_id_for_message(
|
|||||||
user_profile,
|
user_profile,
|
||||||
stream,
|
stream,
|
||||||
error,
|
error,
|
||||||
require_active=require_active,
|
|
||||||
require_content_access=require_content_access,
|
require_content_access=require_content_access,
|
||||||
)
|
)
|
||||||
return (stream, sub)
|
return (stream, sub)
|
||||||
|
Reference in New Issue
Block a user