Change featured tag updates to add/remove activity (#19409)
* Change featured tag updates to add/remove activity * Fix to check for the existence of feature tag * Rename service and worker * Merge AddHashtagSerializer with AddSerializer * Undo removal of sidekiq_options
This commit is contained in:
parent
73a48318a1
commit
74ead7d106
10 changed files with 117 additions and 15 deletions
|
@ -1,10 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::AddSerializer < ActivityPub::Serializer
|
||||
class UriSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
def serializable_hash(*_args)
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
end
|
||||
end
|
||||
|
||||
def self.serializer_for(model, options)
|
||||
case model.class.name
|
||||
when 'Status'
|
||||
UriSerializer
|
||||
when 'FeaturedTag'
|
||||
ActivityPub::HashtagSerializer
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
include RoutingHelper
|
||||
|
||||
attributes :type, :actor, :target
|
||||
attribute :proper_object, key: :object
|
||||
has_one :proper_object, key: :object
|
||||
|
||||
def type
|
||||
'Add'
|
||||
|
@ -15,7 +34,7 @@ class ActivityPub::AddSerializer < ActivityPub::Serializer
|
|||
end
|
||||
|
||||
def proper_object
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
object
|
||||
end
|
||||
|
||||
def target
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
|
||||
context_extensions :hashtag
|
||||
|
||||
include RoutingHelper
|
||||
|
||||
attributes :type, :href, :name
|
||||
|
|
|
@ -1,10 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::RemoveSerializer < ActivityPub::Serializer
|
||||
class UriSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
def serializable_hash(*_args)
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
end
|
||||
end
|
||||
|
||||
def self.serializer_for(model, options)
|
||||
case model.class.name
|
||||
when 'Status'
|
||||
UriSerializer
|
||||
when 'FeaturedTag'
|
||||
ActivityPub::HashtagSerializer
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
include RoutingHelper
|
||||
|
||||
attributes :type, :actor, :target
|
||||
attribute :proper_object, key: :object
|
||||
has_one :proper_object, key: :object
|
||||
|
||||
def type
|
||||
'Remove'
|
||||
|
@ -15,7 +34,7 @@ class ActivityPub::RemoveSerializer < ActivityPub::Serializer
|
|||
end
|
||||
|
||||
def proper_object
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
object
|
||||
end
|
||||
|
||||
def target
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue