Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

streams: Remove require_active in access_stream code path.

Tim Abbotte92d68fffed0
diff --git a/analytics/views/stats.py b/analytics/views/stats.py
index 57c00ae0b7b..9911c0e4576 100644
--- a/analytics/views/stats.py
+++ b/analytics/views/stats.py
@@ -185,7 +185,6 @@ def get_chart_data_for_stream(
stream, ignored_sub = access_stream_by_id(
user_profile,
stream_id,
- require_active=True,
require_content_access=False,
)
diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.py
index e04e2107ac5..468115f1cb3 100644
--- a/zerver/actions/message_edit.py
+++ b/zerver/actions/message_edit.py
@@ -1339,9 +1339,7 @@ def build_message_edit_request(
is_stream_edited = False
target_stream = orig_stream
if stream_id is not None:
- target_stream = access_stream_by_id_for_message(
- user_profile, stream_id, require_active=True
- )[0]
+ target_stream = access_stream_by_id_for_message(user_profile, stream_id)[0]
is_stream_edited = True
return StreamMessageEditRequest(
diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py
index 172a9ee36cd..e035d4d2bf3 100644
--- a/zerver/lib/streams.py
+++ b/zerver/lib/streams.py
@@ -765,7 +765,6 @@ def access_stream_common(
user_profile: UserProfile,
stream: Stream,
error: str,
- require_active: bool = True,
require_content_access: bool = True,
) -> Subscription | None:
"""Common function for backend code where the target use attempts to
@@ -782,7 +781,7 @@ def access_stream_common(
try:
assert stream.recipient_id is not None
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:
sub = None
@@ -803,7 +802,6 @@ def access_stream_common(
def access_stream_by_id(
user_profile: UserProfile,
stream_id: int,
- require_active: bool = True,
require_content_access: bool = True,
) -> tuple[Stream, Subscription | None]:
error = _("Invalid channel ID")
@@ -816,7 +814,6 @@ def access_stream_by_id(
user_profile,
stream,
error,
- require_active=require_active,
require_content_access=require_content_access,
)
return (stream, sub)
@@ -825,7 +822,6 @@ def access_stream_by_id(
def access_stream_by_id_for_message(
user_profile: UserProfile,
stream_id: int,
- require_active: bool = True,
require_content_access: bool = True,
) -> tuple[Stream, Subscription | None]:
"""
@@ -842,7 +838,6 @@ def access_stream_by_id_for_message(
user_profile,
stream,
error,
- require_active=require_active,
require_content_access=require_content_access,
)
return (stream, sub)