Skip to content
Snippets Groups Projects
Commit b87eb8ea authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix #3378 - If favourite/reblog already exists, return it instead of failing (#3641)

parent 8902e265
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,10 @@ class FavouriteService < BaseService
def call(account, status)
authorize_with account, status, :show?
favourite = Favourite.find_by(account: account, status: status)
return favourite unless favourite.nil?
favourite = Favourite.create!(account: account, status: status)
if status.local?
......
......@@ -13,6 +13,10 @@ class ReblogService < BaseService
authorize_with account, reblogged_status, :reblog?
reblog = account.statuses.find_by(reblog: reblogged_status)
return reblog unless reblog.nil?
reblog = account.statuses.create!(reblog: reblogged_status, text: '')
DistributionWorker.perform_async(reblog.id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment