Fix race condition

This commit is contained in:
Justin Edmund 2022-11-17 02:25:22 -08:00
parent 05f6ecc1c7
commit 9967d36f89

View file

@ -110,7 +110,7 @@ class Api::V1::PartiesController < Api::V1::ApiController
def set_from_slug
@party = Party.where("shortcode = ?", params[:id]).first
@party.favorited = (current_user) ? @party.is_favorited(current_user) : false
@party.favorited = (current_user && @party) ? @party.is_favorited(current_user) : false
end
def set