Page MenuHomewrite.as

Support ActivityPub mentions
Open, Medium-HighPublic

Description

Overview

When users make an @-mention in a post, we should parse and send that data to the fediverse.

Background

Uses

Besides allowing more interaction in the fediverse, this also enables an early form of commenting, for those who want it. Users can mention their Mastodon / Pleroma / etc. account in their blog post, so user responses from those platforms will also mention said account, where notifications and richer interactions already exist.

Implementation

  • Parse @user@instance.tld syntax
  • Discover user / instance inbox?
  • Include user mention information in activitystreams data (what properties are needed?)

Event Timeline

matt created this task.Jun 4 2019, 4:21 PM
matt triaged this task as Medium-High priority.
matt added a comment.EditedJul 8 2019, 1:24 PM

We should investigate the feasibility of doing mentions with Markdown links, e.g.

[this user wrote](@user@domain.tld)

as mentioned on the forum.

But this should be a last priority / bonus. First, let's focus on getting the basic functionality there.

qwazix added a subscriber: qwazix.Mon, Oct 7, 1:25 PM

It seems that Mastodon ignores mentions in "Articles". Maybe now that mastodon has the [expand] functionality we should consider using "Note" when federating (at least up to a certain text length at least).

matt added a comment.Mon, Oct 7, 7:31 PM

Hmm. Well that's good to know, but I think changing the entire post type really isn't the right solution. Do mentions work with Pleroma?

Either way, I think we should open a GitHub issue on the Mastodon repo. Maybe we could also talk to the Plume developers about what they're doing -- not sure if they support mentions or not.

matt assigned this task to qwazix.Mon, Oct 7, 7:31 PM
qwazix added a comment.Mon, Oct 7, 7:36 PM

I'll test with pleroma and then open the issue with mastodon. I'll also look around plume.

qwazix added a comment.Tue, Oct 8, 1:03 PM

Just pushed branch activitypub-mentions where mentions work on pleroma.

Next step is to make the handles look like links in the rendered articles, and open an issue on the mastodon tracker.

matt added a comment.Tue, Oct 8, 2:53 PM

Awesome! Sounds good.

We should probably also start a draft pull request for this, so you can link to it from the Mastodon issue.

qwazix added a comment.Tue, Oct 8, 3:46 PM

Ok will do.

I opened an issue on tootsuite here

I'm looking into turning handles into links and I think I should link to the user on remote instances.

This requires webfinger but I think it's wasteful (and slow) to ping servers before each render. I'm thinking of three options:

  1. Use js or link to an internal page that runs webfinger when the user clicks on the link
  2. Add a mentions table to the database that gets populated on save and stores the handle along with the profile endpoint of each user
  3. Just leave it as is and don't turn mentions into links until we see how much this feature gets used
matt added a comment.Wed, Oct 9, 12:45 PM

I think people will definitely expect mentions to turn into links, so we should address that now.

#2 would be a good permanent option for the future, but I think #1 would be better in the short-term. With that internal page, maybe we add some in-memory caching of webfinger results to speed things up.

Another quick and very dirty option for the near-term would be to do what Prismo does, which is to always turn the links into: https://{domain}/@{handle} without running webfinger at all.

matt added a comment.Wed, Oct 9, 1:05 PM

Just to add to #2, we should probably just leverage the remoteusers table, adding a handle column (or however we name it). That would let us look up the handle and associated actor_id.

We'd just want to be sure the row is getting fully populated (i.e., including inbox and shared_inbox columns) when we mention a remote user that isn't already in the table. So that might require another call to get the full actor data (I'm not sure without looking into the code).

qwazix added a comment.EditedWed, Oct 9, 1:17 PM

pixelfed doesn't support the @user syntax (it's pixelfed.social/qwazix and not pixelfed.social/@qwazix) so I think it's not a good idea to do the prismo thing.

When posting I'm already doing that extra call so that I can get the inbox of the user to post to it so we just need to store the handle, inbox and sharedinbox at that point. Nothing else AIUI.

I think we should go for writing to remoteusers immediately. It now seems much less hassle than creating an intermediate page and in-memory caching.

matt added a comment.Wed, Oct 9, 1:29 PM

Sounds good. Just some other things to note about this approach:

  • This will require more database calls to render the page, slowing things down. So I think it's still worth adding an intermediate page that only does the database lookup once a user clicks the link, and then redirects them -- for example, the route could be: /users/@matt@writing.exchange, so that you could populate the <a href= directly from the mentioned handle.
  • We'll need a backwards-compatible way to populate the remoteusers table with handles. I could imagine we do this lazily (only when a user does a mention) or including it in the upgrade process. But I'd prefer that it's done lazily. (Let's discuss this more once you get to this point.)