From 38e7fe2770cc779bc69b0d48ddd4aa82f3bad407 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 8 Apr 2021 15:54:09 +0100 Subject: [PATCH] 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 --- app/models/group.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/group.rb b/app/models/group.rb index 5f752afb030..0b6204fad44 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