Skip to content

Commit 08d373b

Browse files
authored
Fix featured tag form not failing on failed tag validations (mastodon#10167)
1 parent 8edc744 commit 08d373b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/models/featured_tag.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ class FeaturedTag < ApplicationRecord
1818

1919
delegate :name, to: :tag, allow_nil: true
2020

21-
validates :name, presence: true
21+
validates_associated :tag, on: :create
22+
validates :name, presence: true, on: :create
2223
validate :validate_featured_tags_limit, on: :create
2324

2425
def name=(str)
25-
self.tag = Tag.find_or_initialize_by(name: str.delete('#').mb_chars.downcase.to_s)
26+
self.tag = Tag.find_or_initialize_by(name: str.strip.delete('#').mb_chars.downcase.to_s)
2627
end
2728

2829
def increment(timestamp)

0 commit comments

Comments
 (0)