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.

views: Rename *topic local variables to *topic_name.

Prakhar Pratyushbc66eaee7d17
diff --git a/zerver/lib/home.py b/zerver/lib/home.py
index 642bb9b89c8..21026f1e4df 100644
--- a/zerver/lib/home.py
+++ b/zerver/lib/home.py
@@ -137,7 +137,7 @@ def build_page_params_for_home_page_load(
insecure_desktop_app: bool,
narrow: List[NarrowTerm],
narrow_stream: Optional[Stream],
- narrow_topic: Optional[str],
+ narrow_topic_name: Optional[str],
first_in_realm: bool,
prompt_for_invites: bool,
needs_tutorial: bool,
@@ -255,8 +255,8 @@ def build_page_params_for_home_page_load(
if max_message:
page_params["max_message_id"] = max_message.id
page_params["narrow_stream"] = narrow_stream.name
- if narrow_topic is not None:
- page_params["narrow_topic"] = narrow_topic
+ if narrow_topic_name is not None:
+ page_params["narrow_topic"] = narrow_topic_name
page_params["narrow"] = [
dict(operator=term.operator, operand=term.operand) for term in narrow
]
diff --git a/zerver/views/home.py b/zerver/views/home.py
index 725c54e2f12..f9631126545 100644
--- a/zerver/views/home.py
+++ b/zerver/views/home.py
@@ -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,
diff --git a/zerver/views/message_edit.py b/zerver/views/message_edit.py
index 76806d91bf3..aae308d0fa5 100644
--- a/zerver/views/message_edit.py
+++ b/zerver/views/message_edit.py
@@ -34,7 +34,7 @@ def fill_edit_history_entries(
"""
prev_content = message.content
prev_rendered_content = message.rendered_content
- prev_topic = message.topic_name()
+ prev_topic_name = message.topic_name()
# Make sure that the latest entry in the history corresponds to the
# message's last edit time
@@ -48,13 +48,13 @@ def fill_edit_history_entries(
"content": prev_content,
"rendered_content": prev_rendered_content,
"timestamp": edit_history_event["timestamp"],
- "topic": prev_topic,
+ "topic": prev_topic_name,
"user_id": edit_history_event["user_id"],
}
if "prev_topic" in edit_history_event:
- prev_topic = edit_history_event["prev_topic"]
- formatted_entry["prev_topic"] = prev_topic
+ prev_topic_name = edit_history_event["prev_topic"]
+ formatted_entry["prev_topic"] = prev_topic_name
# Fill current values for content/rendered_content.
if "prev_content" in edit_history_event:
@@ -79,7 +79,7 @@ def fill_edit_history_entries(
"content": prev_content,
"rendered_content": prev_rendered_content,
"timestamp": datetime_to_timestamp(message.date_sent),
- "topic": prev_topic,
+ "topic": prev_topic_name,
"user_id": message.sender_id,
}