Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
3b024c56
Unverified
Commit
3b024c56
authored
2 years ago
by
Eugen Rochko
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix not being able to input featured tag with `#` (#19535)
parent
ad83e647
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/featured_tag.rb
+8
-0
app/models/featured_tag.rb
with
8 additions
and
0 deletions
+8
-0
app/models/featured_tag.rb
+
8
-
0
View file @
3b024c56
...
...
@@ -19,6 +19,8 @@ class FeaturedTag < ApplicationRecord
validate
:validate_tag_name
,
on: :create
validate
:validate_featured_tags_limit
,
on: :create
before_validation
:strip_name
before_create
:set_tag
before_create
:reset_data
...
...
@@ -48,6 +50,12 @@ class FeaturedTag < ApplicationRecord
private
def
strip_name
return
unless
defined?
(
@name
)
@name
=
@name
&
.
strip
&
.
gsub
(
/\A#/
,
''
)
end
def
set_tag
self
.
tag
=
Tag
.
find_or_create_by_names
(
@name
)
&
.
first
end
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets