Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upActivityPub objects contain links to Friendica for hashtags and mentions #8642
Comments
The way we are creating these tags is done comparable to how Pleroma and Mastodon are doing it. To find (and probably change) the links you should have a look at the provided array where all mentions and tags should be summed up. See https://mastodon.social/@heluecht/104178141231819096 and https://pleroma.soykaf.com/objects/84c48190-1925-469b-844f-57d2fb99e34c for a comparism. |
It’s pretty absurd to me to present the user with a link that yanks them away from their platform to one where they’re not logged in, possibly with a different UX, and they cannot take any meaningful action on the information presented when they get there. The content doesn’t even appear in a new window. Even more absurd is to expect other developers to parse out HTML in order to get to the original, untainted content the user entered in the first place, when it would be easier not to do so. Those links should be applied in the presentation layer: they’re easy to parse and allow developers to provide a simpler, richer user experience. By applying them earlier Friendica, Pleroma and Mastodon remove that option from other developers and prevent users from getting a better experience. So to get my users the experience I want them to have, I need to write code that somehow detects that some (but not all) links in content are actually hashtags or mentions (while others are not), remove them, piece the text back together (because you’ve broken the text nodes with your links by leaving the Does that seem like a reasonable thing to do, or should all servers just leave the user content unmolested and allow servers to interpret and display it to the best of their ability? I apologize for the rant, but this seems like a terrible state of affairs. |
We've been having the philosophy "Send strict, accept lax" but this is clearly a case where we could send stricter without links referring back to the originating node that are supposed to be discarded by the receiving server. |
We can enclose the hashtag inside of the link, that's no problem. But AFAIK the other systems are only looking for links with |
This is our current policy at Friendica: we treat plain text hashtags as, well, plain text. However the Mammoth message contains the hashtag in the |
Is there a consistent, agreed-upon specification as to precisely what constitutes a hashtag? I'm using |
I believe this could be the reason we send/parse links, so that you don't have to use a regular expression to know what the full tag is, since it's going to be whatever is in the text node of the link. This allows spaces in received tags even though we don't allow the creation of such tags in Friendica. But to answer your question, if |
Since hashtags could be in Korean, Icelandic, Cyrillic, Japanese (Hiragana, Katakana or Kanji), Chinese and whatever. So finding a good rule is a problem. That's the reason why I prefer having this work done via the remote system. I will soon add a coding so that the hashtag will be part of the link. I also will check if other systems do need that CSS class in the link or if the |
We probably still need to support plain hashtags with the corresponding string in the |
I guess that plaintext hashtags don't work well with other systems. I can try it out, of course. |
Just for received messages. We can keep outputting links in the body. |
AFAIK we always parse the incoming plaintext for hashtags. |
This isn’t the case for the last two Mammoth message I received from @koehn . |
koehn commentedMay 16, 2020
Expected behavior
Content in objects transmitted over activitypub should not contain hashtags and mentions surrounded by links to the Friendica server.
Actual behavior
Content in objects transmitted over activitypub contain hashtags and mentions surrounded by links to the Friendica server. The links render the hashtags unparsable by other servers, because they're inserted between the hashtag symbol
#
and the name of the hashtag. They also contain CSS information relevant only to Friendica servers.The links lead to confusion for users, as they link away from the server they're on to a page on another server. This is inconsistent with the general user experience for these applications.
Steps to reproduce the problem