0
0
Fork 0

Set and store report URIs (#10303)

Fixes #10271
This commit is contained in:
ThibG 2019-03-17 15:34:56 +01:00 committed by Eugen Rochko
parent 5e38ef87a7
commit a20354a20b
8 changed files with 52 additions and 6 deletions

View file

@ -13,6 +13,7 @@
# action_taken_by_account_id :bigint(8)
# target_account_id :bigint(8) not null
# assigned_account_id :bigint(8)
# uri :string
#
class Report < ApplicationRecord
@ -28,6 +29,12 @@ class Report < ApplicationRecord
validates :comment, length: { maximum: 1000 }
def local?
false # Force uri_for to use uri attribute
end
before_validation :set_uri, only: :create
def object_type
:flag
end
@ -89,4 +96,8 @@ class Report < ApplicationRecord
Admin::ActionLog.from("(#{sql}) AS admin_action_logs")
end
def set_uri
self.uri = ActivityPub::TagManager.instance.generate_uri_for(self) if uri.nil? && account.local?
end
end