message edit: Add frontend support for stream-change events.

This is part of #6427, adding support for live-updating the Zulip UI
to move messages to a new topic.

As noted in the comments, there is still a bug to be fixed here
involving guest users, but the overall implementation is pretty well
tested manually (which is how we test most message-edit UI work since
there's so much complexity involved).

Co-Authored-By: Wbert Adrián Castro Vera <wbertc@gmail.com>
This commit is contained in:
Tim Abbott
2020-04-07 13:29:22 -07:00
parent 843345dfee
commit 7990676583
2 changed files with 64 additions and 19 deletions

View File

@@ -393,8 +393,9 @@ exports.get_unread_messages = function (messages) {
exports.update_unread_topics = function (msg, event) {
const new_topic = util.get_edit_event_topic(event);
const {new_stream_id} = event;
if (new_topic === undefined) {
if (new_topic === undefined && new_stream_id === undefined) {
return;
}
@@ -407,8 +408,8 @@ exports.update_unread_topics = function (msg, event) {
);
exports.unread_topic_counter.add(
msg.stream_id,
new_topic,
new_stream_id || msg.stream_id,
new_topic || msg.topic,
msg.id
);
};