ActivityPub Plugin

You might have to explain this to me like I’m 5.

If my organization is on Mastodon at https://example.social/@MyOrganization

Can I have a category in Discourse that shows all of the organization’s posts to Mastodon?

https://discourse.example.org//c/fediverse/67

And any interactions with those posts (Favorite or Reply) on Mastodon will be represented in the Discourse posts in that category?

And any interactions with those posts in Discourse will be visible in Mastodon?

I’ll wait for you to confirm or disconfirm before I ask my follow-up questions.

1 Like

I answer for all those I know for sure.

Yes you can. Then that category follows your Mastodon account.

Replies yes. Favorites (stars) no, because role of it is just showing those ”likes” locally to that mastodon users. Others, like your category or who ever is following that user, aka. your organization, never sees given favorites.

This is my issue at the moment, but no in the meaning comments written under a topic in a category doesn’t travel to Mastodon.

But if you allow, then that category can be followed from Mastodon and then everything written is public in Mastodon — depending of your settings, topics and posts, or just first post of topics. Reactions don’t move to Mastodon.

Basically:

  • if a category follows a mastodon user: Discourse gets from Mastodon
  • if a mastodon user follows a category: Mastodon gets from Discourse

So emphasis is, simplified point of view for sure,

  • if the main point is tell to forum users, and Mastodon users see only if they follow, then publishing happens in topics and Mastodon users see only if someone follows that category (or they know how to find that category as an ActivityPub user)
  • if the main point is tell to Mastodon users, and forum users see if they follow that category, and federated participation isn’t needed from category, then that category follows your mastodon user

Almost same thing, but messages are shown differently in Mastodon.

One thing. Because of limits of Mastodon practically every markdown tags is shown as is, meaning for example bolding doesn’t happen on Mastodon, and followers see **bold** instead of bold. And tags doesn’t move here or there.

2 Likes

I have a Discourse sandbox, if you need a beta tester.

1 Like

The reason you can’t currently follow that account is because it’s a bot. We haven’t added follow support for bots yet.

This seems to be due to Mastodon’s Authorized fetch being enabld on mastodonapp.uk. I’ll look at that again in the next day or so.

I’d note that when you follow a hastag on Mastodon it’s only going to show you posts with that hastag that are already on the server you’re on. If there are posts with that hastag on another Mastodon server you’re not going to see them. To put it another way, Mastodon has not added primary ActivityPub support to their hastags (e.g. they haven’t made them Actors like the Discourse Plugin does for Discourse tags). See the docs and the discussion here. It may still be possible to do, but it will require some kind of relaying or perhaps polling.

You’ll need to share the message itself for me to tell you more (i.e. not just the backtrace). When you have verbose logging enabled the plugin will log failures to process incoming objects. There can be many reasons for a failure to process, many of which are not related to Discourse. The fediverse has a lot of objects flying around all of the time. I may change the log level of these failures to process to just “info” as I think they suggest to people a problem with the plugin itself when in most cases there isn’t a problem on the Discourse end of things.

Yes, they should appear as replies on Mastodon. Specific examples are always best as I can analyse what has happened and can address anything that needs to be addressed (if anything does need to be addressed).

Yes, that is how the “Full Topic” setting works. See further

1 Like

I don’t know what messages it is related to, but I got a lot those. But I’ll try to figure it out (I’m quite sure I have verbose logging enable, but my memory is reallu unreliable). On other hand, I don’t see any strange behaviour anywhere.

Tags, bots etc — thanks, that explained a lot.

How do I do that? Because that happens with every single one, not with some.

edit

I don’t know if this helps a bit, but this came up one minute before before that warning:

[Discourse Activity Pub] Failed to process https://mastodon.social/users/fesshole: Object is not supported

It was boosted message by me.

And with same timestamp with that warning was this:

[Discourse Activity Pub] Failed to process https://mastodon.social/users/moa333#delete: Object is not ready

If I have to guess that latest one is related to the handlers::warning, and both are informative ones, and I don’t need to care about those at all?

edit2

Yeah, the issue was HTTP signature. The plugin wanted it, but my Mastodon didn’t use it. When disabled at both ends (perhaps enabling on both sites would do the same) messages started travel here, there and everywhere.

I must dig deeper what are actual pros and cons of using that setting.

Thanks to lead me to right direction!

1 Like

Thanks for sharing. I’ll be looking at our implementation of HTTP signatures again in the next day or so in the context of looking at Mastodon Authorized fetch. Perhaps they’ve changed how they handle signatures, or we need to tweak our handling.

Because I thought (on imagination level, no facts) that if I have signatures on in Discourse and off in Mastodon, messages will go from Discourse to Mastodon (because the instance doesn’t use HTTP signatures), but not from Mastodon to Discourse (because the forum wants HTTP signatures). But what happened was totally opposite.

But actor of Mastodon (my account) is connected to my Discourse user, and I am an admin — can it mean something?

Anyway, when both aren’t using HTTP signature everything works as expected. I’m fine with that, but you as a dev might be another story :smirk:

I’m not sure how much strong valid benefits HTTP signature gives. At some point, not too long time ago, Pixelfed had problems with Mastodon when sinatures were in use. And we have third player too — Wordpress.

Anyhow, I’m off topic now.

1 Like

This account should be discoverable when this is merged and then deployed on your server.

3 Likes

@Jagster All of your replies will also be showing up properly on Mastodon when this is merged.

(Mastodon tweaked some handling on their end)

3 Likes

This is fixed now @tvavrda. Sorry about that, I missed a step in the process.

2 Likes

Trying to follow a peertube account in a category but it doesn’t get past pending.

Here’s what’s in the logs

POST request to https://spectra.video/accounts/spoilerdiacre/inbox failed: Expected([200, 201, 202]) <=> Actual(403 Forbidden)
https://community.derpandchill.com/ap/actor/ca233d6f9d47cde558877fb7609a6b3a failed to deliver to https://spectra.video/accounts/spoilerdiacre/inbox

I did try it multiple times. I know they are different, but it would be nice to automatically post videos to my community.

Thanks for the report, I’ll investigate more closely later this week.

About federating between Discourse and Mastodon. There is few things I don’t understand, I can’t or/and I’m expecting too much. I put some links. The content is in Finnish, but content isn’t important I guess.

Forum actors and boosting

If I’m understanding right, a category actor federates topic by boosting it, because real user is an actor, but things just not work that way, yet anyway. So boosting is only way to do federating?

But it creates a situation where a mastodon-user sees it as boosted one and original sender is, as an example, my @Jagster@foorumi.katiska.eu. But they never follow booster account, but original one, as my personal forum-account — but they can’t, because they see approval request, and I can’t do that. So they never follow anybody.

Article vs. Note

I don’t understand what I should expect, but I think those are working opposite.

If I’m using form Note, Discourse will federated first post as it is. Like this: Sokeriton kofeiini voi olla terveellistä - Ihminen, luonto & maailma - Meta/KATISKA (and as usual ActivityPub links etc. finds as usual; BTW, I like that new way to show it, even I don’t totally use it)

That one shows ”Read more” but clicking it opens content in Mastodon.

This one is an Article: Onko koiran peitsaaminen aina merkki ongelmasta? - Koiramaailma - Meta/KATISKA
It shows only the title and links to that topic. So reading in Mastodon is impossible.

edit: sorry about the after edit mess, but I just realized this article type was shown coming from my forum-actor, not as boosted one by category-actor. It does it every time; two differen things: original and boosting :man_facepalming: That was nice, though. But following my forum-actor is still impossible because of approval; it acts like a locked account.

I tried read this (mega)topic, and I bothered ask.discourse.com too. Is that ability to show full article done exacly using linking, not showing content itself? If so, it is unnessary for Mastodon, because it can show longer contents too, and I will use note instead of article.

Federation of discussion

When I’ve federated a topic, and someone is commenting there, that will show up under that topic just nicely. But if I comment to that topic in forum, that will be federated, but no one sees it as a comment of that topic (or thread in Mastodon), because it has sended as a boost by category actor?

Is this such situation where (official) Mastodon app tells that maybe all comments aren’t in this instance, and you should open original one — and no one never does it.

This is a topic where I had two independent discussions where forum saw everything, but Mastodon didn’t know about comments written in forum: Pikkulasten ruuat? - Retkeily & Melonta - Meta/KATISKA

Edit that topic is ~5 days old at moment of writing this, and it has boosted and published by category-actor, not by my forum user. Has something changed between then and now (yes, I do rebuilding almost every day).

1 Like

It’s not the only way, but it’s the primary way used by forum-like platforms to federate groups of topics/threads (i.e. with a particular tag or category). The process is described in something called FEP-1b12 which we follow, and have been working, on with other implementers.

Sorry I’m not quite following what the issue is here. Could you try re-phrasing this?

The reason this happens is because Mastodon stopped converting the contents of Articles and just showed a link to the original content. Given the rise of forums in the fediverse, e.g. us!, it may be time soon for a new PR to mastodon to re-add that support.

Yes, there were some changes in this respect recently, because Mastodon made various changes on their end of things. There will likely be more changes to come as we seek to refine the approach here. If you could lay out specific examples of things not meeting your expectations, e.g. Post 1 (Discourse), Reply 1 (Mastodon), Reply 2 (Discourse) etc, or something similar that would be helpful.

1 Like

I don’t have too many expectations, but some wishes I have :joy:. Everything else is now clear, but that boost/writer thingy. I may not have any issue any more.

I’m talking about how it shows in Mastodon.

  • boosted by actor of the category
  • original one is my user from the forum

When I clicked my actor from forum, it showed this (screenshot from Mona-app, but official PWA showed same, but its way)

That red icon is follow request, same as if it would be a locked profile.

Then I did rebuilding.

Now official PWA shows what it should:

But Mona shows still that red icon.

For some reason I, or anyone else, couldn’t follow my forum actor because of that. But now it is fixed (some strange issue between two systems :man_shrugging:). And now used mastodon-app doesn’t update its content — but that is not your headache in any means.

So this post was only informative showing… something :joy:

1 Like

One small cosmetic feature request: could we have a graphical indicator to show when a post comes from ActivityPub actor? Just like we see an envelope icon when someone uses email.

Reason for that is my users are confused because they don’t see the difference between local forum users and Mastodon-users.

Why should they know that? I don’t know. People just act like that and I like to keep them calm. And we are indicating emails too, and that isn’t needed either or beeing an important detail at all.

There is an indicator when a post is from a remote actor, it’s a blue AP icon, in the exact same spot as the mail icon, by the post date.

That’s for replies, for the OP, the same icon in blue plus more details are displayed just below the topic map.

1 Like

Now when you told that, I can see the difference, barely :joy:

Do you remember the CSS to change either color more clearer?

Edit

To change those two colors could be easier way too, but as my profile says, I’m just another copy&paster. So I took this from the source.

Because I have zero understanding what all those tertiaries etc. are in the real world I used basic web-colors.

.activity-pub-topic-status,
.activity-pub-post-status {

  &.published .d-icon-discourse-activity-pub,
  &.updated .d-icon-discourse-activity-pub {
    color: #808080;
  }
  &.published-remote .d-icon-discourse-activity-pub {
    color: #008000;
  }
}
2 Likes

EDIT

Following issue is connected to @a.gup.pe user. Every federated categories find user @koirat@a.gup.pe and follows it showin status waiting. Changing the page and returning back shows nothing, that following has disappeared.

Categories can follow real humans, though.

That actor is de facto a bot, and Discourse can’t follow bots — but AFAIK it doesn’t identified itself as a bot. And even the issue would be the bottiness (is that even a word :flushed:) Discourse shouldn’t let me follow it in the first place (unless Discourse doesn’t know that in that moment). Anyway, it should not terminate following without telling me. Or did it… I haven’t check out logs, my bad.

EDIT2

This was all I found.

failed to deliver to https://a.gup.pe/u/koirat/inbox
[Discourse Activity Pub] https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd failed to deliver to https://a.gup.pe/u/koirat/inbox
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
id: https://foorumi.katiska.eu/ap/activity/e05428a3d5d0d9637c8b191bc4556063
type: Follow
to: https://a.gup.pe/u/koirat
published: '2025-02-23T07:11:19Z'
updated: '2025-02-23T07:11:19Z'
actor: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
  id: https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd
  type: Group
  updated: '2025-02-20T08:03:45Z'
  url: https://foorumi.katiska.eu/c/koiramaailma/33
  name: 'Katiska.eu: koiramaailma'
  inbox: https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd/inbox
  outbox: https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd/outbox
  followers: https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd/followers
  preferredUsername: koiramaailma
  publicKey: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
    id: https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd#main-key
    owner: https://foorumi.katiska.eu/ap/actor/b37cda0cddecb02465691872595307dd
    publicKeyPem: |
      -----BEGIN PUBLIC KEY-----
     (This isn’t relevant, I guess. It’s just taking space)
      -----END PUBLIC KEY-----
  icon: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
    type: Image
    mediaType: image/png
    url: https://cdnfoorumi.katiska.eu/original/1X/c51c0a678551648d73e3f8729ec95ecd1fc0bb73.png
  "@context": https://www.w3.org/ns/activitystreams
"@context": https://www.w3.org/ns/activity...

Webfinger finds that a.gup.pe-user, so that can’t be reason for that.

Is this an edge case, or am I again trying to do something strange?

Discourse can’t follow Mastodon-lists (and those have own issues in Mastodon too). So I tried a.gup.pe ”pseudo user” instead.

I created @koirat@a.gup.pe by following same user in my instance — it will collect toots where is used tag #koirat (dogs in Finnish, BTW). That went well.

Then I send a message from Mastodon and both, tag and user, were mentioned. It pop up into list, that followed guppe-user.

In my Discourse I asked category X to follow user @koirat@a.gup.pe. I have another category Y following my actor @jagster@kvarkki.nexus, it was in status waiting. So I was expecting to get that message twice, one from me and one via guppe (oh, for f sake, is that the problem :thinking:).

The message sended by my actor was published in category Y, as expected. Category X didn’t get anything delivered by guppe-actor.

When I opened federation of category X, it wasn’t following @koirat@a.gup.pe anymore.

So what are guesses:

  • @a.gup.pe works some different way and Discourse can’t understand it
  • I tried to publish two identifal topics from Mastodon (this I can try easily, will take few moments)

This isn’t purely academical issue, because it would solve out list-problems of Mastodon.

The reason that’s not working is because when Discourse tries to send a Follow to a.gup.pe/u/koirat/inbox it’s getting a 500 internal server error in response.

HTTP/1.1 500 Internal Server Error\r\n

In other words, there’s a bug in Guppe.

I would note that the collective fediverse approach to groups is currently evolving somewhat. I’m discussing it, and a few other related issues, currently with folks from NodeBB, Wordpress, Mastodon and others. See for example:

The other issue that Guppe is going to face is that Mastodon itself has been working on a “Group” feature for some time which may conflict with the Guppe approach.

4 Likes