-
-
Notifications
You must be signed in to change notification settings - Fork 671
Internal links ignore /near/MSGID
pointing to specific messages
#3604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
(Moving this from the issue description, to add a bit of structure.) For how to go about implementing proper behavior for these links, here's some background from reading the code:
So a reasonable strategy would be:
|
One good place to start would be the TODO in src/message/messagesActions.js:
|
See CZO where I described a latent bug where the message list shows messages consecutively, when they aren't actually consecutive. And some brainstorming for a solution: we need to better keep the invariant that a |
Reported again today in chat by @jyn514:
Probably the main symptom of this issue is when people follow the "said" links inserted by quote-and-reply. They work OK if the linked-to conversation is very short; but if it's longer, and especially if the link is within the same conversation -- which is very common for quote-and-reply "said" links -- then they're not very helpful until we resolve this issue. I also just looked at #4377, from early this year, and I believe it's another report of that same symptom. |
Implementing the algorithm described in the issue and on CZO: zulip#5306 (comment) > When a user clicks a `/near/` link in a message, > > 1. Get the message, either from our local data structures or > (failing that) from a single-message fetch, using the API added > in zulip/zulip#21391. > 2. If the message is currently in the stream and topic encoded in > the `/near/` link, open the topic narrow for that stream/topic, > and scroll to the message*. > 3. If the message was *at some point* in the stream and topic > encoded in the `/near/` link, according to its `edit_history`, > open the topic narrow for the stream/topic that the message is > currently in, and scroll to the message*. > 4. Otherwise (i.e., the message was never in the stream/topic > encoded in the `/near/` link), open the topic narrow for the > stream/topic encoded in the link, and scroll to the message > "nearest" to the message ID*. > > *Actually opening a narrow scrolled to a specific message ID is > blocked on zulip#3604. It actually turned out quite easy to do the special handling for part 4, so that's included here. (The bit about blocking on zulip#3604 is still true.) Fixes: zulip#5306
Implementing the algorithm described in the issue and on CZO: zulip#5306 (comment) > When a user clicks a `/near/` link in a message, > > 1. Get the message, either from our local data structures or > (failing that) from a single-message fetch, using the API added > in zulip/zulip#21391. > 2. If the message is currently in the stream and topic encoded in > the `/near/` link, open the topic narrow for that stream/topic, > and scroll to the message*. > 3. If the message was *at some point* in the stream and topic > encoded in the `/near/` link, according to its `edit_history`, > open the topic narrow for the stream/topic that the message is > currently in, and scroll to the message*. > 4. Otherwise (i.e., the message was never in the stream/topic > encoded in the `/near/` link), open the topic narrow for the > stream/topic encoded in the link, and scroll to the message > "nearest" to the message ID*. > > *Actually opening a narrow scrolled to a specific message ID is > blocked on zulip#3604. It actually turned out quite easy to do the special handling for part 4, so that's included here. (The bit about blocking on zulip#3604 is still true.) Fixes: zulip#5306
Implementing the algorithm described in the issue and on CZO: zulip#5306 (comment) > When a user clicks a `/near/` link in a message, > > 1. Get the message, either from our local data structures or > (failing that) from a single-message fetch, using the API added > in zulip/zulip#21391. > 2. If the message is currently in the stream and topic encoded in > the `/near/` link, open the topic narrow for that stream/topic, > and scroll to the message*. > 3. If the message was *at some point* in the stream and topic > encoded in the `/near/` link, according to its `edit_history`, > open the topic narrow for the stream/topic that the message is > currently in, and scroll to the message*. > 4. Otherwise (i.e., the message was never in the stream/topic > encoded in the `/near/` link), open the topic narrow for the > stream/topic encoded in the link, and scroll to the message > "nearest" to the message ID*. > > *Actually opening a narrow scrolled to a specific message ID is > blocked on zulip#3604. It actually turned out quite easy to do the special handling for part 4, so that's included here. (The bit about blocking on zulip#3604 is still true.) Fixes: zulip#5306
Uh oh!
There was an error while loading. Please reload this page.
@rishig reports:
This is a kind of followup to #2760 -- just a few weeks ago we made such links work at all, going to the right narrow, but the
near
part which should point to a specific message isn't working.Looking in the code, a link in the message list is handled here:
But then the only thing that
doNarrow
does with itsanchor
parameter is to make sure to fetch messages around that desired anchor:It doesn't actually do anything to try to place our scroll position there.
Looking through the history, it seems like in fact this code may never have worked. Certainly as far back as commit fcff285 a bit over two years ago, when
messageLinkPress
itself was created in a small refactoring, theanchor
parameter has been computed and then mostly ignored; in fact at that point, it was completely ignored, not even used for trying to fetch the right messages.The text was updated successfully, but these errors were encountered: