message_edit: Store which user edited a given message.

This is important for, in the future, being able to display who edited
the topic of a message if that wasn't the person who originally sent
the message.
This commit is contained in:
Tim Abbott 2017-02-19 15:23:42 -08:00
parent f1d82af191
commit 976868cf01
2 changed files with 7 additions and 1 deletions

View File

@ -2689,9 +2689,14 @@ def do_update_embedded_data(user_profile, message, content, rendered_content):
def do_update_message(user_profile, message, subject, propagate_mode, content, rendered_content):
# type: (UserProfile, Message, Optional[Text], str, Optional[Text], Optional[Text]) -> int
event = {'type': 'update_message',
# TODO: We probably want to remove the 'sender' field
# after confirming it isn't used by any consumers.
'sender': user_profile.email,
'user_id': user_profile.id,
'message_id': message.id} # type: Dict[str, Any]
edit_history_event = {} # type: Dict[str, Any]
edit_history_event = {
'user_id': user_profile.id,
} # type: Dict[str, Any]
changed_messages = [message]
# Set first_rendered_content to be the oldest version of the

View File

@ -367,6 +367,7 @@ class EventsRegisterTest(ZulipTestCase):
('stream_id', check_int),
('subject', check_string),
('subject_links', check_list(None)),
('user_id', check_int),
# There is also a timestamp field in the event, but we ignore it, as
# it's kind of an unwanted but harmless side effect of calling log_event.
])