Skip to content

Commit

Permalink
Allow system user to be an actor (#125)
Browse files Browse the repository at this point in the history
This restriction keeps topics authored by system users from being published. There's no need for this restriction.
  • Loading branch information
angusmcleod authored Oct 23, 2024
1 parent 9051c43 commit a0e3ad5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@

add_to_class(:user, :activity_pub_enabled) { DiscourseActivityPub.enabled }
add_to_class(:user, :activity_pub_ready?) { true }
add_to_class(:user, :activity_pub_allowed?) { self.human? }
add_to_class(:user, :activity_pub_allowed?) { true }
add_to_class(:user, :activity_pub_url) { full_url }
add_to_class(:user, :activity_pub_icon_url) { avatar_template_url.gsub("{size}", "96") }
add_to_class(:user, :activity_pub_save_access_token) do |domain, access_token|
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/discourse_activity_pub/actor_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@
end
end

context "with a non-human user" do
let!(:user) { Discourse.system_user }

it "creates an actor" do
actor = described_class.update_or_create_actor(user)
expect(actor.reload.model_id).to eq(user.id)
end
end

context "with a category" do
let!(:category) { Fabricate(:category) }

Expand Down

0 comments on commit a0e3ad5

Please sign in to comment.