fix the build

This commit is contained in:
Arpit Jalan 2018-10-22 15:08:26 +05:30
parent c39a1022cc
commit 597d4863d6

View File

@ -2,7 +2,7 @@ class MaxEmojisValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value) def validate_each(record, attribute, value)
unescaped_title = PrettyText.unescape_emoji(Emoji.unicode_unescape(CGI::escapeHTML(value))) unescaped_title = PrettyText.unescape_emoji(Emoji.unicode_unescape(CGI::escapeHTML(value)))
if unescaped_title.scan(/<img.+?class\s*=\s*'(emoji|emoji emoji-custom)'/).size > SiteSetting.max_emojis_in_title if unescaped_title.present? && unescaped_title.scan(/<img.+?class\s*=\s*'(emoji|emoji emoji-custom)'/).size > SiteSetting.max_emojis_in_title
record.errors.add( record.errors.add(
attribute, SiteSetting.max_emojis_in_title > 0 ? :max_emojis : :emojis_disabled, attribute, SiteSetting.max_emojis_in_title > 0 ? :max_emojis : :emojis_disabled,
max_emojis_count: SiteSetting.max_emojis_in_title max_emojis_count: SiteSetting.max_emojis_in_title