ActivityPub Plugin

Thank you for your work here! Really looking forward to turning this on, and thanks for releasing it for testing, so that those of us with various setups can contribute at least testing in a wider set of scenarios.

As I think about when to turn this on for my site, I’m trying to think through what the “one-way doors” might be.

Sub-categories

I have 8 top-level categories, but in addition I have 21 public sub-categories. Having to follow 29 actors to follow all public site activity seems like a lot. Additionally, it might be a surprise to users that following a category doesn’t follow the sub-categories.

If I could select an option in category ActivityPub settings for “also federate public sub-categories” I would do that. Whether to separately federate sub-categories feels like a mostly one-way door from a user point of view, I think. So if you would consider an “also federate sub-categories” option, that might inform my plans. Our default sidebar shows only the top-level categories, and the Discourse default when looking at them is all the top-level and sub-category content together, so this seems reasonably consistent with Discourse expectations.

Federate all the things!

I think that it might be interesting to also add a site-wide setting for an ActivityPub actor that federates all public posts on a site. I would use that myself. But I don’t see that as a one-way door — I would set up category federation as soon as it was otherwise ready, even if later I was going to add an “all@” actor to federate out everything.

Edit limitations

One of the things that is not obvious from your post is that it can be read that it is only the literal [note]...[/note] section that can’t be edited. For others here, what it really means is that if you federate, editing is currently disabled on all posts as soon as they are federated (except for posts with a literal [note]...[/note] section); this message shows up only when you try to save your edit:

My site intentionally allows sufficiently trusted users to edit indefinitely, so I can’t turn this on without the ability to disable this control (or the control being removed because edits are federated). By way of a general example applicable beyond such trusting sites, any category with wiki-mode posts will be broken by setting up federation for that category.

I tried to delete a federated post that I had made a wiki, and got this:

However, the post was deleted and the deletion was federated.

Personality

It would be nice to provide a profile picture for each designated actor. In Mastodon, I just see the gray elephant picture for each category actor, and I’d love to add a little personality here. :smiling_face:

Error logs

I have gotten two kinds of errors in my logs from the activitypub plugin so far:

Message (3 copies reported)

NoMethodError (undefined method `ap_type' for nil:NilClass)
(eval):7:in `_fast_attributes'
app/controllers/application_controller.rb:418:in `block in with_resolved_locale'
app/controllers/application_controller.rb:418:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:367:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'

Backtrace

plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:18:in `object'
plugins/discourse-activity-pub/app/serializers/discourse_activity_pub/ap/activity_serializer.rb:18:in `_object'
plugins/discourse-activity-pub/app/serializers/discourse_activity_pub/ap/activity_serializer.rb:9:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:347:in `as_json'
plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/object.rb:50:in `json'
plugins/discourse-activity-pub/app/serializers/discourse_activity_pub/ap/collection/ordered_collection_serializer.rb:7:in `map'
plugins/discourse-activity-pub/app/serializers/discourse_activity_pub/ap/collection/ordered_collection_serializer.rb:7:in `ordered_items'
(eval):7:in `_fast_attributes'
Message

Job exception: undefined method `model' for #<DiscourseActivityPubActivity id: 2, ap_id: "https://social.makerforums.info/cf2e1e8d-83e3-447e...", ap_key: nil, ap_type: "Follow", local: nil, actor_id: 3, object_id: "1", object_type: "DiscourseActivityPubActor", summary: nil, published_at: nil, created_at: "2023-06-01 02:23:13.798564000 +0000", updated_at: "2023-06-01 02:23:13.798564000 +0000">


Backtrace

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activemodel-7.0.4.3/lib/active_model/attribute_methods.rb:458:in `method_missing'
/var/www/discourse/plugins/discourse-activity-pub/app/models/discourse_activity_pub_activity.rb:79:in `after_deliver'
/var/www/discourse/plugins/discourse-activity-pub/app/jobs/discourse_activity_pub_deliver.rb:42:in `perform_request'
/var/www/discourse/plugins/discourse-activity-pub/app/jobs/discourse_activity_pub_deliver.rb:13:in `execute'
/var/www/discourse/app/jobs/base.rb:249:in `block (2 levels) in perform'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rails_multisite-5.0.0/lib/rails_multisite/connection_management.rb:82:in `with_connection'
/var/www/discourse/app/jobs/base.rb:236:in `block in perform'
/var/www/discourse/app/jobs/base.rb:232:in `each'
/var/www/discourse/app/jobs/base.rb:232:in `perform'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.9/lib/sidekiq/processor.rb:202:in `execute_job'

Thanks again for your work on this!

8 Likes