Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
narrow: Add flags column outside get_base_query_for_search.
Anders Kaseorg5a56b53689d4
diff --git a/zerver/lib/narrow.py b/zerver/lib/narrow.pyindex 454a81efb5e..3cd2d26ac3e 100644--- a/zerver/lib/narrow.py+++ b/zerver/lib/narrow.py@@ -1081,7 +1081,7 @@ def get_base_query_for_search(assert user_profile is not Noneif need_message:query = (- select(column("message_id", Integer), column("flags", Integer))+ select(column("message_id", Integer))# We don't limit by realm_id despite the join to# zerver_messages, since the user_profile_id limit in# usermessage is more selective, and the query planner@@ -1100,7 +1100,7 @@ def get_base_query_for_search(return (query, inner_msg_id_col)query = (- select(column("message_id", Integer), column("flags", Integer))+ select(column("message_id", Integer)).where(column("user_profile_id", Integer) == literal(user_profile.id)).select_from(table("zerver_usermessage")))@@ -1173,6 +1173,7 @@ def find_first_unread_anchor(need_message=need_message,need_user_message=need_user_message,)+ query = query.add_columns(column("flags", Integer))query, is_search = add_narrow_conditions(user_profile=user_profile,@@ -1461,6 +1462,8 @@ def fetch_messages(need_message=need_message,need_user_message=need_user_message,)+ if need_user_message:+ query = query.add_columns(column("flags", Integer))query, is_search = add_narrow_conditions(user_profile=user_profile,