From 1f4de8328dae357f3b3e761f9e869d86d9ba12c7 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 1 Feb 2019 18:39:28 -0800 Subject: [PATCH] actions: Add a comment explaining historical messages in detail. --- zerver/lib/actions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 34e0c7166d..5bbb485d84 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -3952,7 +3952,14 @@ def do_update_message_flags(user_profile: UserProfile, assert messages is not None msgs = UserMessage.objects.filter(user_profile=user_profile, message__id__in=messages) - # Hack to let you star any message + # This next block allows you to star any message, even those you + # didn't receive (e.g. because you're looking at a public stream + # you're not subscribed to, etc.). The problem is that starring + # is a flag boolean on UserMessage, and UserMessage rows are + # normally created only when you receive a message to support + # searching your personal history. So we need to create one. We + # add UserMessage.flags.historical, so that features that need + # "messages you actually received" can exclude these UserMessages. if msgs.count() == 0: if not len(messages) == 1: raise JsonableError(_("Invalid message(s)"))