messages: Require join with zerver_message if use_first_unread_anchor.

This fixes a 500 bug where the RN mobile app would simply fail to load
old messages if use_first_unread_anchor was not set.
This commit is contained in:
Tim Abbott 2017-03-20 21:16:40 -07:00
parent ee2e6a31b1
commit aa7e4fec35
1 changed files with 1 additions and 1 deletions

View File

@ -540,7 +540,7 @@ def get_old_messages_backend(request, user_profile,
if include_history and not use_first_unread_anchor: if include_history and not use_first_unread_anchor:
query = select([column("id").label("message_id")], None, table("zerver_message")) query = select([column("id").label("message_id")], None, table("zerver_message"))
inner_msg_id_col = literal_column("zerver_message.id") inner_msg_id_col = literal_column("zerver_message.id")
elif narrow is None: elif narrow is None and not use_first_unread_anchor:
query = select([column("message_id"), column("flags")], query = select([column("message_id"), column("flags")],
column("user_profile_id") == literal(user_profile.id), column("user_profile_id") == literal(user_profile.id),
table("zerver_usermessage")) table("zerver_usermessage"))