about summary refs log tree commit diff
path: root/app/lib/activitypub/activity/like.rb
blob: 2c4a9d80504d39a1a0f3b29147984f1fae3b9497 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class ActivityPub::Activity::Like < ActivityPub::Activity
  def perform
    return if autoreject?
    original_status = status_from_uri(object_uri)

    return if original_status.nil? || !original_status.account.local? || delete_arrived_first?(@json['id']) || @account.favourited?(original_status)

    favourite = original_status.favourites.create!(account: @account)
    NotifyService.new.call(original_status.account, favourite)
  end
end