Skip to content

anchors 10/n: Open /near/ links at message #1566

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

Merged
merged 8 commits into from
Jun 12, 2025
Merged

Conversation

gnprice
Copy link
Member

@gnprice gnprice commented Jun 12, 2025

Fixes #82.

This is the next round after #1515 — and completes #82, as well as bringing us close to #80. (These changes were previously sent as part of #1517.)

This branch is a draft only because of a lack of tests. The changes it does have are ready for review.

This doesn't implement the other aspect of the behavior of /near/ links, i.e. to follow the message if it's been moved to another conversation. That's tracked as #683.

@gnprice gnprice added the maintainer review PR ready for review by Zulip maintainers label Jun 12, 2025
@gnprice gnprice marked this pull request as draft June 12, 2025 02:56
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great—very excited for this! One small comment below, and I see you've just filed #1569 / #1570 for tests.

Comment on lines 224 to 228
case _NarrowOperator.near: // TODO(#82): support for near
continue;
case _NarrowOperator.near:
if (nearMessageId != null) return null;
nearMessageId = int.tryParse(operand, radix: 10);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could reject the link (i.e. return null) if the int.tryParse returns null, like we do for /with/sdlfkjasdlkf in the case _NarrowOperator.with_ above this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good thought — will do.

gnprice added 8 commits June 12, 2025 15:16
This is NFC as to the live app, because nothing yet passes this
argument.
When the message list is truly far back in history -- for example,
at first unread in the combined feed or a busy channel, for a user
who has some old unreads going back months and years -- trying to
scroll smoothly to the bottom is hopeless.  The only way to get to
the newest messages in any reasonable amount of time is to jump there.

So, do that.
This will give us room to start returning additional information
from parsing the URL, in particular the /near/ operand.
Fixes zulip#82.

One TODO comment for this issue referred to an aspect I'm leaving out
of scope for now, namely when opening a notification rather than an
internal Zulip link.  So I've filed a separate issue zulip#1565 for that,
and this updates that comment to point there.
@gnprice gnprice marked this pull request as ready for review June 12, 2025 22:24
@gnprice
Copy link
Member Author

gnprice commented Jun 12, 2025

Thanks for the review! Made that tweak, and I also went through and converted the TODOs in commit messages into TODO comments pointing to #1569 or #1570.

(Plus made the actual test changes in one commit, where they were simple:
cb94d4e internal_link [nfc]: Propagate InternalLink up to caller
)

That way I think we can go ahead and merge this.

@chrisbobbe
Copy link
Collaborator

chrisbobbe commented Jun 12, 2025

Yep! Please do, maybe waiting till CI passes. (The range-diff looks fine to me.)

@gnprice gnprice merged commit 8cb2c7b into zulip:main Jun 12, 2025
1 check passed
@gnprice
Copy link
Member Author

gnprice commented Jun 12, 2025

Thanks! Merged.

@gnprice gnprice deleted the pr-near branch June 12, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open a message list in the middle of history, when requested
2 participants