diff options
author | Starfall <us@starfall.systems> | 2022-11-10 08:50:11 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2022-11-10 08:50:11 -0600 |
commit | 67d1a0476d77e2ed0ca15dd2981c54c2b90b0742 (patch) | |
tree | 152f8c13a341d76738e8e2c09b24711936e6af68 /app/lib/activitypub/activity/remove.rb | |
parent | b581e6b6d4a5ba9ed4ae17427b7f2d5d158be4e5 (diff) | |
parent | ee7e49d1b1323618e16026bc8db8ab7f9459cc2d (diff) |
Merge remote-tracking branch 'glitch/main'
- Remove Helm charts - Lots of conflicts with our removal of recommended settings and custom icons
Diffstat (limited to 'app/lib/activitypub/activity/remove.rb')
-rw-r--r-- | app/lib/activitypub/activity/remove.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/remove.rb b/app/lib/activitypub/activity/remove.rb index f523ead9f..f5cbef675 100644 --- a/app/lib/activitypub/activity/remove.rb +++ b/app/lib/activitypub/activity/remove.rb @@ -2,8 +2,22 @@ class ActivityPub::Activity::Remove < ActivityPub::Activity def perform - return unless @json['target'].present? && value_or_id(@json['target']) == @account.featured_collection_url + 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 @@ -11,4 +25,13 @@ class ActivityPub::Activity::Remove < ActivityPub::Activity 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 |