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

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

diff --git a/app/models/group.rb b/app/models/group.rb
index 5f752af..0b6204f 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -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

GitHub sha: 38e7fe27

This commit appears in #12650 which was approved by CvX. It was merged by davidtaylorhq.