about summary refs log tree commit diff
path: root/app/services/unfavourite_service.rb
blob: de6e84e7d460ed12d74f53627b0585a7288476ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

class UnfavouriteService < BaseService
  def call(account, status)
    favourite = Favourite.find_by!(account: account, status: status)
    favourite.destroy!

    unless status.local?
      NotificationWorker.perform_async(favourite.stream_entry.id, status.account_id)
    end

    favourite
  end
end