mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Rename ActivityPubPayloadGeneration
to ActivityPub::Identifier
This commit is contained in:
parent
74a6d62d85
commit
065f9c5976
5 changed files with 24 additions and 22 deletions
|
@ -13,7 +13,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class Block < ApplicationRecord
|
class Block < ApplicationRecord
|
||||||
include ActivityPubPayloadGeneration
|
include ActivityPub::Identifier
|
||||||
include Paginable
|
include Paginable
|
||||||
include RelationshipCacheable
|
include RelationshipCacheable
|
||||||
|
|
||||||
|
|
21
app/models/concerns/activity_pub/identifier.rb
Normal file
21
app/models/concerns/activity_pub/identifier.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module ActivityPub
|
||||||
|
module Identifier
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
before_validation :generate_global_identifier,
|
||||||
|
only: :create,
|
||||||
|
unless: :uri?
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def generate_global_identifier
|
||||||
|
self.uri = ActivityPub::TagManager
|
||||||
|
.instance
|
||||||
|
.generate_activity_uri
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,19 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module ActivityPubPayloadGeneration
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
included do
|
|
||||||
before_validation :generate_payload_uri,
|
|
||||||
only: :create,
|
|
||||||
unless: :uri?
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def generate_payload_uri
|
|
||||||
self.uri = ActivityPub::TagManager
|
|
||||||
.instance
|
|
||||||
.generate_activity_uri
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -16,7 +16,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class Follow < ApplicationRecord
|
class Follow < ApplicationRecord
|
||||||
include ActivityPubPayloadGeneration
|
include ActivityPub::Identifier
|
||||||
include Paginable
|
include Paginable
|
||||||
include RelationshipCacheable
|
include RelationshipCacheable
|
||||||
include RateLimitable
|
include RateLimitable
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class FollowRequest < ApplicationRecord
|
class FollowRequest < ApplicationRecord
|
||||||
include ActivityPubPayloadGeneration
|
include ActivityPub::Identifier
|
||||||
include Paginable
|
include Paginable
|
||||||
include RelationshipCacheable
|
include RelationshipCacheable
|
||||||
include RateLimitable
|
include RateLimitable
|
||||||
|
|
Loading…
Reference in a new issue