message_events: Reorder to better organize variables.

This commit is contained in:
Tim Abbott
2022-08-05 17:20:26 -07:00
parent 675c42f40b
commit d0fb83c2eb

View File

@@ -181,16 +181,6 @@ export function update_messages(events) {
message_edit.end_message_row_edit($row); message_edit.end_message_row_edit($row);
} }
// new_topic will be undefined if the topic is unchanged.
const new_topic = util.get_edit_event_topic(event);
// new_stream_id will be undefined if the stream is unchanged.
const new_stream_id = event.new_stream_id;
// old_stream_id will be present and valid for all stream messages.
const old_stream_id = event.stream_id;
// old_stream will be undefined if the message was moved from
// a stream that the current user doesn't have access to.
const old_stream = sub_store.get(event.stream_id);
// Save the content edit to the front end msg.edit_history // Save the content edit to the front end msg.edit_history
// before topic edits to ensure that combined topic / content // before topic edits to ensure that combined topic / content
// edits have edit_history logged for both before any // edits have edit_history logged for both before any
@@ -221,6 +211,16 @@ export function update_messages(events) {
msg.raw_content = event.content; msg.raw_content = event.content;
} }
// new_topic will be undefined if the topic is unchanged.
const new_topic = util.get_edit_event_topic(event);
// new_stream_id will be undefined if the stream is unchanged.
const new_stream_id = event.new_stream_id;
// old_stream_id will be present and valid for all stream messages.
const old_stream_id = event.stream_id;
// old_stream will be undefined if the message was moved from
// a stream that the current user doesn't have access to.
const old_stream = sub_store.get(event.stream_id);
// A topic or stream edit may affect multiple messages, listed in // A topic or stream edit may affect multiple messages, listed in
// event.message_ids. event.message_id is still the first message // event.message_ids. event.message_id is still the first message
// where the user initiated the edit. // where the user initiated the edit.