Bundle of corrections and one doorkeeper writing role change

This commit is contained in:
Fosco Marotto
2021-02-09 22:32:24 -05:00
parent 382fd31ec7
commit 729c00a5a9
12 changed files with 18 additions and 45 deletions

View File

@@ -10,16 +10,7 @@ class FavouriteService < BaseService
def call(account, status)
authorize_with account, status, :favourite?
favourite = nil
begin
favourite = Favourite.find_by(account: account, status: status)
rescue ActiveRecord::RecordNotFound
favourite = Favourite.find_by(account: account, status: status)
end
return favourite unless favourite.nil?
favourite = Favourite.create!(account: account, status: status)
favourite = Favourite.find_or_create_by!(account: account, status: status)
create_notification(favourite)
bump_potential_friendship(account, status)