Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_topics: Refactor the construction loop for UserTopicDict.
Zixuan James Li4f4d61cb59da
diff --git a/zerver/lib/user_topics.py b/zerver/lib/user_topics.pyindex 11723155f6b..1b1f722ba04 100644--- a/zerver/lib/user_topics.py+++ b/zerver/lib/user_topics.py@@ -43,11 +43,17 @@ def get_user_topics(result = []for row in rows:- if not include_stream_name:- del row["stream__name"]+ user_topic_dict: UserTopicDict = {+ "stream_id": row["stream_id"],+ "topic_name": row["topic_name"],+ "visibility_policy": row["visibility_policy"],+ "last_updated": datetime_to_timestamp(row["last_updated"]),+ }- row["last_updated"] = datetime_to_timestamp(row["last_updated"])- result.append(row)+ if include_stream_name:+ user_topic_dict["stream__name"] = row["stream__name"]++ result.append(user_topic_dict)return result