about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lib/activitypub/activity/create.rb2
-rw-r--r--app/models/poll_vote.rb3
-rw-r--r--app/serializers/activitypub/vote_serializer.rb2
3 files changed, 5 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index fc4c45692..07ef16bf3 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -241,7 +241,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
 
   def poll_vote?
     return false if replied_to_status.nil? || replied_to_status.poll.nil? || !replied_to_status.local? || !replied_to_status.poll.options.include?(@object['name'])
-    replied_to_status.poll.votes.create!(account: @account, choice: replied_to_status.poll.options.index(@object['name']))
+    replied_to_status.poll.votes.create!(account: @account, choice: replied_to_status.poll.options.index(@object['name']), uri: @object['id'])
   end
 
   def resolve_thread(status)
diff --git a/app/models/poll_vote.rb b/app/models/poll_vote.rb
index 57781d616..aec678968 100644
--- a/app/models/poll_vote.rb
+++ b/app/models/poll_vote.rb
@@ -9,6 +9,7 @@
 #  choice     :integer          default(0), not null
 #  created_at :datetime         not null
 #  updated_at :datetime         not null
+#  uri        :string
 #
 
 class PollVote < ApplicationRecord
@@ -20,6 +21,8 @@ class PollVote < ApplicationRecord
 
   after_create_commit :increment_counter_cache
 
+  delegate :local?, to: :account
+
   private
 
   def increment_counter_cache
diff --git a/app/serializers/activitypub/vote_serializer.rb b/app/serializers/activitypub/vote_serializer.rb
index 655d04d22..248190404 100644
--- a/app/serializers/activitypub/vote_serializer.rb
+++ b/app/serializers/activitypub/vote_serializer.rb
@@ -6,7 +6,7 @@ class ActivityPub::VoteSerializer < ActiveModel::Serializer
                :in_reply_to, :to
 
     def id
-      [ActivityPub::TagManager.instance.uri_for(object.account), '#votes/', object.id].join
+      ActivityPub::TagManager.instance.uri_for(object) || [ActivityPub::TagManager.instance.uri_for(object.account), '#votes/', object.id].join
     end
 
     def type