FIX: Use the S3 CDN for the Group flair (#12130)

This commit is contained in:
Rafael dos Santos Silva 2021-02-18 17:24:44 -03:00 committed by GitHub
parent 180249112f
commit d86cb7d1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,7 @@ class Group < ActiveRecord::Base
include HasCustomFields include HasCustomFields
include AnonCacheInvalidator include AnonCacheInvalidator
include HasDestroyedWebHook include HasDestroyedWebHook
include GlobalPath
cattr_accessor :preloaded_custom_field_names cattr_accessor :preloaded_custom_field_names
self.preloaded_custom_field_names = Set.new self.preloaded_custom_field_names = Set.new
@ -750,7 +751,14 @@ class Group < ActiveRecord::Base
end end
def flair_url def flair_url
flair_icon.presence || flair_upload&.url case flair_type
when :icon
flair_icon
when :image
upload_cdn_path(flair_upload.url)
else
nil
end
end end
[:muted, :regular, :tracking, :watching, :watching_first_post].each do |level| [:muted, :regular, :tracking, :watching, :watching_first_post].each do |level|