Fix featured tags not finding the right tag on save (#11504)

Regression from b838607
lolsob-rspec
Eugen Rochko 2019-08-07 10:00:58 +02:00 committed by GitHub
parent 6362ac6617
commit b55fd4f12d
2 changed files with 7 additions and 2 deletions

View File

@ -324,7 +324,8 @@
&.active h4 { &.active h4 {
&, &,
.fa, .fa,
small { small,
.trends__item__current {
color: $primary-text-color; color: $primary-text-color;
} }
} }
@ -337,6 +338,10 @@
&.active .avatar-stack .account__avatar { &.active .avatar-stack .account__avatar {
border-color: $ui-highlight-color; border-color: $ui-highlight-color;
} }
.trends__item__current {
padding-right: 0;
}
} }
} }

View File

@ -23,7 +23,7 @@ class FeaturedTag < ApplicationRecord
validate :validate_featured_tags_limit, on: :create validate :validate_featured_tags_limit, on: :create
def name=(str) def name=(str)
self.tag = Tag.find_or_initialize_by(name: str.strip.delete('#').mb_chars.downcase.to_s) self.tag = Tag.find_or_create_by_names(str.strip)&.first
end end
def increment(timestamp) def increment(timestamp)