-
-
Notifications
You must be signed in to change notification settings - Fork 671
Follow /near/ links through topic moves/renames #5306
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
See details of a recent API change around |
Here's a description of an algorithm to implement, on CZO:
with
|
We'll use this for zulip#5306; see the plan in discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M5306.20Follow.20.2Fnear.2F.20links.20through.20topic.20moves.2Frenames/near/1407930 In particular, we want the stream and topic for a stream message that we fetch using this endpoint (which we'd do as a fallback for when we don't already have the message in our data structures.)
We'll use this for zulip#5306; see the plan in discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M5306.20Follow.20.2Fnear.2F.20links.20through.20topic.20moves.2Frenames/near/1407930 In particular, we want the stream and topic for a stream message that might not be in our data structures. We'll use this endpoint to fetch that information.
NFC because we always drop the result of this function on the floor, after passing it to doNarrow. But we need this to start giving the right answer, for zulip#5306, "Follow /near/ links through topic moves/renames".
There were two things wrong here: - `url.includes('near')` was a pretty poor heuristic to decide if the narrow link has a "near" operator. It would give false positives if "near" appeared somewhere other than the operator-operand pair "/near/{message_id}", e.g., if it appeared in the realm's base URL (if `url` is an absolute URL string), or a stream or topic name in an operand. - Once we (unsoundly) decided that there was a "near" operator, we'd try to locate it in hashSegments by searching *all* of hashSegments, including ones that represent operands. This could be thrown off by an operand with the value "near", as in `topic/near`. NFC because we always drop the result of this function on the floor, after passing it to doNarrow. But we need this to start giving the right answer, for zulip#5306, "Follow /near/ links through topic moves/renames".
There were two things wrong here: - `url.includes('near')` was a pretty poor heuristic to decide if the narrow link has a "near" operator. It would give false positives if "near" appeared somewhere other than the operator-operand pair "/near/{message_id}", e.g., if it appeared in the realm's base URL (if `url` is an absolute URL string), or a stream or topic name in an operand. - Once we (unsoundly) decided that there was a "near" operator, we'd try to locate it in hashSegments by searching *all* of hashSegments, including ones that represent operands. This could be thrown off by an operand with the value "near", as in `topic/near`. NFC because we always drop the result of this function on the floor, after passing it to doNarrow. But we need this to start giving the right answer, for zulip#5306, "Follow /near/ links through topic moves/renames".
There were two things wrong here: - `url.includes('near')` was a pretty poor heuristic to decide if the narrow link has a "near" operator. It would give false positives if "near" appeared somewhere other than the operator-operand pair "/near/{message_id}", e.g., if it appeared in the realm's base URL (if `url` is an absolute URL string), or a stream or topic name in an operand. - Once we (unsoundly) decided that there was a "near" operator, we'd try to locate it in hashSegments by searching *all* of hashSegments, including ones that represent operands. This could be thrown off by an operand with the value "near", as in `topic/near`. NFC because we always drop the result of this function on the floor, after passing it to doNarrow. But we need this to start giving the right answer, for zulip#5306, "Follow /near/ links through topic moves/renames".
There were two things wrong here: - `url.includes('near')` was a pretty poor heuristic to decide if the narrow link has a "near" operator. It would give false positives if "near" appeared somewhere other than the operator-operand pair "/near/{message_id}", e.g., if it appeared in the realm's base URL (if `url` is an absolute URL string), or a stream or topic name in an operand. - Once we (unsoundly) decided that there was a "near" operator, we'd try to locate it in hashSegments by searching *all* of hashSegments, including ones that represent operands. This could be thrown off by an operand with the value "near", as in `topic/near`. NFC because we always drop the result of this function on the floor, after passing it to doNarrow. But we need this to start giving the right answer, for zulip#5306, "Follow /near/ links through topic moves/renames".
We'll use this for zulip#5306; see the plan in discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M5306.20Follow.20.2Fnear.2F.20links.20through.20topic.20moves.2Frenames/near/1407930 In particular, we want the stream and topic for a stream message that might not be in our data structures. We'll use this endpoint to fetch that information.
We'll use this for zulip#5306; see the plan in discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M5306.20Follow.20.2Fnear.2F.20links.20through.20topic.20moves.2Frenames/near/1407930 In particular, we want the stream and topic for a stream message that might not be in our data structures. We'll use this endpoint to fetch that information.
We'll use this for zulip#5306; see the plan in discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M5306.20Follow.20.2Fnear.2F.20links.20through.20topic.20moves.2Frenames/near/1407930 In particular, we want the stream and topic for a stream message that might not be in our data structures. We'll use this endpoint to fetch that information.
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
We'll use this for zulip#5306; see the plan in discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M5306.20Follow.20.2Fnear.2F.20links.20through.20topic.20moves.2Frenames/near/1407930 In particular, we want the stream and topic for a stream message that might not be in our data structures. We'll use this endpoint to fetch that information. topic edit modal [nfc]: Add TopicModalProvider context component. Contains visibility context and handler callback context. Sets up context for modal handler to be called inside topic action sheets. topic edit modal [nfc]: Provide topic modal Context hook to children. The useTopicModalHandler is called normally in TopicItem and TitleStream. In order to deliver the callbacks to the action sheets in MessageList, the context hook is called in ChatScreen and a bit of prop-drilling is performed. topic edit modal: Add translation for action sheet button. topic edit modal: Add modal and functionality to perform topic name updates. Fixes zulip#5365 topid edit modal [nfc]: Revise Flow types for relevant components. topic edit modal: Modify webview unit tests to accommodate feature update.
This is a new feature on web in zulip/zulip#21426 / zulip/zulip#15290, fixing a regular pain point with resolved topics in particular. We should adopt it on mobile too.
To implement it, we'll probably want to move some of the implementation into shared code so we can reuse it. In particular
message_edit.stream_and_topic_exist_in_edit_history
:zulip/zulip@2a48528
Note that we'll also need to resume maintaining the
edit_history
property on messages. Currently inmessageReducer.js
we have, since 055f45d:The text was updated successfully, but these errors were encountered: