diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 4f416b39cdf033..a82edb9a203415 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -208,8 +208,8 @@ def postprocess_status! def validate_status! raise Mastodon::ValidationError, I18n.t('statuses.contains_ng_words') if Admin::NgWord.reject?("#{@options[:spoiler_text]}\n#{@options[:text]}") - raise Mastodon::ValidationError, I18n.t('statuses.too_many_hashtags') if Admin::NgWord.hashtag_reject_with_extractor?(@options[:text]) - raise Mastodon::ValidationError, I18n.t('statuses.too_many_mentions') if Admin::NgWord.mention_reject_with_extractor?(@options[:text]) + raise Mastodon::ValidationError, I18n.t('statuses.too_many_hashtags') if Admin::NgWord.hashtag_reject_with_extractor?(@text) + raise Mastodon::ValidationError, I18n.t('statuses.too_many_mentions') if Admin::NgWord.mention_reject_with_extractor?(@text) end def validate_status_mentions! diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb index da47dfb5f56afd..59caf4c6bb5b3e 100644 --- a/app/services/update_status_service.rb +++ b/app/services/update_status_service.rb @@ -82,7 +82,8 @@ def update_media_attachments! def validate_status! raise Mastodon::ValidationError, I18n.t('statuses.contains_ng_words') if Admin::NgWord.reject?("#{@options[:spoiler_text]}\n#{@options[:text]}") - raise Mastodon::ValidationError, I18n.t('statuses.too_many_hashtags') if Admin::NgWord.hashtag_reject_with_extractor?(@options[:text]) + raise Mastodon::ValidationError, I18n.t('statuses.too_many_hashtags') if Admin::NgWord.hashtag_reject_with_extractor?(@options[:text] || '') + raise Mastodon::ValidationError, I18n.t('statuses.too_many_mentions') if Admin::NgWord.mention_reject_with_extractor?(@options[:text] || '') end def validate_status_mentions!