mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
get_old_messages: Refactor handling of UserMessage flags.
This is in preparation for having a case in which we query the database directly to get the message flags, without going through a UserMessage object. (imported from commit d5218974680b0c4b028a84f3aae1c8242ceb08ce)
This commit is contained in:
@@ -406,9 +406,11 @@ class UserMessage(models.Model):
|
||||
display_recipient = get_display_recipient(self.message.recipient)
|
||||
return (u"<UserMessage: %s / %s (%s)>" % (display_recipient, self.user_profile.email, self.flags_dict())).encode("utf-8")
|
||||
|
||||
def flags_dict(self):
|
||||
return dict(flags = [flag for flag in self.flags.keys() if getattr(self.flags, flag).is_set])
|
||||
def flags_list(self):
|
||||
return [flag for flag in self.flags.keys() if getattr(self.flags, flag).is_set]
|
||||
|
||||
def flags_dict(self):
|
||||
return dict(flags = [self.flags_list()])
|
||||
|
||||
class Subscription(models.Model):
|
||||
user_profile = models.ForeignKey(UserProfile)
|
||||
|
||||
Reference in New Issue
Block a user