mastodon/app/services/unfavourite_service.rb

17 lines
395 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class UnfavouriteService < BaseService
2017-02-11 02:12:05 +01:00
include StreamEntryRenderer
def call(account, status)
favourite = Favourite.find_by!(account: account, status: status)
favourite.destroy!
unless status.local?
2017-02-11 02:12:05 +01:00
NotificationWorker.perform_async(stream_entry_to_xml(favourite.stream_entry), account.id, status.account_id)
end
favourite
end
end