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 in b2cb443d24, and that call was
removed in 378062cc83.
This commit is contained in:
Tim Abbott
2025-03-07 13:09:51 -08:00
parent 322199efeb
commit e92d68fffe
3 changed files with 2 additions and 10 deletions

View File

@@ -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,
) )

View File

@@ -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(

View File

@@ -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)