views: Rename *topic local variables to *topic_name.

This is preparatory work towards adding a Topic model.
We plan to use the local variable name as 'topic' for
the Topic model objects.

Currently, we use *topic as the local variable name for
topic names.

We rename local variables of the form *topic to *topic_name
so that we don't need to think about type collisions in
individual code paths where we might want to talk about both
Topic objects and strings for the topic name.
This commit is contained in:
Prakhar Pratyush
2024-01-13 18:32:59 +05:30
committed by Tim Abbott
parent 1eef052bd1
commit bc66eaee7d
3 changed files with 14 additions and 14 deletions

View File

@@ -110,7 +110,7 @@ def detect_narrowed_window(
narrow: List[NarrowTerm] = []
narrow_stream = None
narrow_topic = request.GET.get("topic")
narrow_topic_name = request.GET.get("topic")
if "stream" in request.GET:
try:
@@ -121,9 +121,9 @@ def detect_narrowed_window(
narrow = [NarrowTerm(operator="stream", operand=narrow_stream.name)]
except Exception:
logging.warning("Invalid narrow requested, ignoring", extra=dict(request=request))
if narrow_stream is not None and narrow_topic is not None:
narrow.append(NarrowTerm(operator="topic", operand=narrow_topic))
return narrow, narrow_stream, narrow_topic
if narrow_stream is not None and narrow_topic_name is not None:
narrow.append(NarrowTerm(operator="topic", operand=narrow_topic_name))
return narrow, narrow_stream, narrow_topic_name
def update_last_reminder(user_profile: Optional[UserProfile]) -> None:
@@ -207,7 +207,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
if need_accept_tos(user_profile):
return accounts_accept_terms(request)
narrow, narrow_stream, narrow_topic = detect_narrowed_window(request, user_profile)
narrow, narrow_stream, narrow_topic_name = detect_narrowed_window(request, user_profile)
if user_profile is not None:
first_in_realm = realm_user_count(user_profile.realm) == 1
@@ -232,7 +232,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
insecure_desktop_app=insecure_desktop_app,
narrow=narrow,
narrow_stream=narrow_stream,
narrow_topic=narrow_topic,
narrow_topic_name=narrow_topic_name,
first_in_realm=first_in_realm,
prompt_for_invites=prompt_for_invites,
needs_tutorial=needs_tutorial,