-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix duplicate featured tags #19403
Fix duplicate featured tags #19403
Conversation
Fix #19220 ? |
Oh, that's exactly what I'm talking about. Error handling on the setting page was missing. Please wait a moment. |
app/models/featured_tag.rb
Outdated
@@ -58,5 +60,6 @@ def validate_featured_tags_limit | |||
def validate_tag_name | |||
errors.add(:name, :blank) if @name.blank? | |||
errors.add(:name, :invalid) unless @name.match?(/\A(#{Tag::HASHTAG_NAME_RE})\z/i) | |||
errors.add(:name, I18n.t('featured_tags.errors.duplicate_hashtag')) if FeaturedTag.by_name(@name).where(account_id: account_id).exists? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should trigger the normal :taken
error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix it.
* Fix duplicate featured tags * Add unique tag name validator * Fix error message
* Fix duplicate featured tags * Add unique tag name validator * Fix error message
There was a bug that allowed featured tags with the same tag to be created because the unique constraint was not set. Fix this.