FIX: emoji rebuild when changing emoji set for the 1st time

This commit is contained in:
Régis Hanol 2015-01-07 17:54:09 +01:00
parent 114cc1c851
commit 2b3e311e8e

View File

@ -2,12 +2,15 @@ require 'enum_site_setting'
class EmojiSetSiteSetting < EnumSiteSetting
NAME = :emoji_set
# fix the URLs when changing the site setting
DiscourseEvent.on(:site_setting_saved) do |site_setting|
if site_setting.name.to_s == "emoji_set" && site_setting.value_changed?
if site_setting.name == NAME && site_setting.value_changed?
Emoji.clear_cache
before = "/images/emoji/#{site_setting.value_was}/"
previous_value = site_setting.value_was || SiteSetting.defaults[NAME]
before = "/images/emoji/#{previous_value}/"
after = "/images/emoji/#{site_setting.value}/"
Scheduler::Defer.later("Fix Emoji Links") do