FIX: Ensure group flair upload is present when deciding type (#12650)

Previously, if the upload_id was present, but the upload was missing, the entire site would give a server error.

We have no foreign keys on this relation, so we have to be able to cope with the situation where the upload_id is present, but the actual upload has been deleted.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
David Taylor 2021-04-08 15:54:09 +01:00 committed by GitHub
parent eb7ff576e5
commit 38e7fe2770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -747,7 +747,7 @@ class Group < ActiveRecord::Base
def flair_type
return :icon if flair_icon.present?
return :image if flair_upload_id.present?
return :image if flair_upload.present?
end
def flair_url