blob: f5cbef67571d6f3483a8737031b7f009d36799f5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# frozen_string_literal: true
class ActivityPub::Activity::Remove < ActivityPub::Activity
def perform
return if @json['target'].blank?
case value_or_id(@json['target'])
when @account.featured_collection_url
case @object['type']
when 'Hashtag'
remove_featured_tags
else
remove_featured
end
end
end
private
def remove_featured
status = status_from_uri(object_uri)
return unless !status.nil? && status.account_id == @account.id
pin = StatusPin.find_by(account: @account, status: status)
pin&.destroy!
end
def remove_featured_tags
name = @object['name']&.delete_prefix('#')
return if name.blank?
featured_tag = FeaturedTag.by_name(name).find_by(account: @account)
featured_tag&.destroy!
end
end
|