Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hashtag link detection is inconsistent with web UI #959

Open
Tamschi opened this issue Jan 8, 2025 · 2 comments · May be fixed by #960
Open

Hashtag link detection is inconsistent with web UI #959

Tamschi opened this issue Jan 8, 2025 · 2 comments · May be fixed by #960

Comments

@Tamschi
Copy link

Tamschi commented Jan 8, 2025

Mastodon for Android requires the hashtag class on anchor elements to treat them as hashtag links:

if(el.hasClass("hashtag")){
String text=el.text();
if(text.startsWith("#")){
linkType=LinkSpan.Type.HASHTAG;
href=text.substring(1);
linkObject=tagsByTag.get(text.substring(1).toLowerCase());

The web interface does not (and also covers hashtag links with outer "#"): https://github.com/mastodon/mastodon/blob/67a8d4638c6e6a3ef178258504a6535746608c42/app/javascript/hooks/useLinks.ts#L13-L15

This occasionally causes trouble: snarfed/bridgy-fed#1634 (comment)

It would be good to have parity here. Personally I'd prefer the behaviour of the web version, as I think I saw a post where the link didn't cover the "#".

@grishka
Copy link
Member

grishka commented Jan 8, 2025

Interesting, I had no idea the web app does any parsing of its own. I thought it just trusts what the server returns like I do. I've noticed that Friendica does the same thing with not including the # in the link. Just for reference, here's a Friendica post in the web app:
Image
Here's the same post in Smithereen (that doesn't support hashtags at all so treats them as links):
Image

@Gargron what's your opinion on this? To me it feels like something that should be handled server-side.

@Tamschi
Copy link
Author

Tamschi commented Jan 8, 2025

@Gargron what's your opinion on this? To me it feels like something that should be handled server-side.

For what it's worth, I made a quick patch to achieve parity here.

I think it would be possible and helpful to overall match by href instead or additionally though,
as that would additionally avoid compatibility issues with Mastodon's Unicode folding in hashtags.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants