Skip to content

Commit 39f1cf4

Browse files
authored
FIX: Prevent ActorHandler from attempting to apply updates to categories or tags (#208)
Reference: https://meta.discourse.org/t/activitypub-plugin/266794/432?u=angus
1 parent 56b5920 commit 39f1cf4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/discourse_activity_pub/actor_handler.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def build_actor
4040
end
4141

4242
def update_or_create_user
43+
return if model_type.present? && model_type != "User"
4344
@model_type = "User"
4445
return invalid_opts unless valid_actor?
4546

spec/lib/discourse_activity_pub/actor_handler_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
end
3333
end
3434

35+
context "when the actor is for a category or tag" do
36+
let!(:actor) { Fabricate(:discourse_activity_pub_actor_group) }
37+
38+
it "does nothing" do
39+
result = described_class.update_or_create_user(actor)
40+
expect(result).to eq(nil)
41+
end
42+
end
43+
3544
context "when actor has user" do
3645
let!(:user) { Fabricate(:user) }
3746

0 commit comments

Comments
 (0)