2017-08-09 05:52:15 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityPub::Activity::Like < ActivityPub::Activity
|
|
|
|
def perform
|
|
|
|
original_status = status_from_uri(object_uri)
|
|
|
|
|
2017-08-21 00:53:47 +10:00
|
|
|
return if original_status.nil? || !original_status.account.local? || delete_arrived_first?(@json['id']) || @account.favourited?(original_status)
|
2017-08-09 05:52:15 +10:00
|
|
|
|
2017-08-21 00:53:47 +10:00
|
|
|
favourite = original_status.favourites.create!(account: @account)
|
2020-09-19 01:26:45 +10:00
|
|
|
NotifyService.new.call(original_status.account, :favourite, favourite)
|
2017-08-09 05:52:15 +10:00
|
|
|
end
|
|
|
|
end
|