mastodon-android icon indicating copy to clipboard operation
mastodon-android copied to clipboard

Hashtag link detection is inconsistent with web UI

Open Tamschi opened this issue 1 year ago • 2 comments

Mastodon for Android requires the hashtag class on anchor elements to treat them as hashtag links: https://github.com/mastodon/mastodon-android/blob/9361c6d0dfcd1eb9d641f86219df6f5a86e44dac/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java#L148-L153

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: https://github.com/snarfed/bridgy-fed/issues/1634#issuecomment-2577383556

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 "#".

Tamschi avatar Jan 08 '25 12:01 Tamschi

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.

grishka avatar Jan 08 '25 12:01 grishka

@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.

Tamschi avatar Jan 08 '25 13:01 Tamschi