-
-
Notifications
You must be signed in to change notification settings - Fork 677
Description
(new description written 2021-07 by @gnprice)
When a message gets edited, we reflect the edit in state.messages
, but not in other data structures that know about the message. In particular state.unread
(that's #4840), and state.narrows
.
This means that if a message has its topic and/or stream change, then if you've already seen that message in a message list (so that we have an entry in state.narrows
for that narrow), it will still be in the old narrow if you go and look there.
Conversely, if you've already looked at the new narrow where it should appear, so that we've fetched from that narrow covering the point where the message would appear, I believe this means the message won't show up there. (But if you first visit the narrow only after the edit happened, then it will, because we fetch the relevant messages from the server.)
A particularly salient way for this to show up is if you're looking at a topic narrow, and edit a message's topic yourself. You're looking right at it in that narrow, and it won't disappear. (This was reported as #4830.)
The way we'll fix this is to add a case for EVENT_UPDATE_MESSAGE
in narrowsReducer.js
. It should be sure to
- handle stream edits as well as topic edits (see also Support moving messages between streams #3957);
- handle whole-stream narrows as well as topic narrows;
- add to the new narrows, if applicable, as well as remove from the old.
- For the nuances of "applicable", see jsdoc on
NarrowsState
andCaughtUpState
, and the existing logic thatnarrowsReducer.js
has for theEVENT_NEW_MESSAGE
case.
- For the nuances of "applicable", see jsdoc on