Set tags max length to 160

This commit is contained in:
decabeza
2019-02-04 19:06:37 +01:00
parent 282ae61139
commit 4d71a70e1e
2 changed files with 4 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ App.Tags =
unless $this.data('initialized') is 'yes' unless $this.data('initialized') is 'yes'
$this.on('click', -> $this.on('click', ->
name = $(this).text() name = '"' + $(this).text() + '"'
current_tags = $tag_input.val().split(',').filter(Boolean) current_tags = $tag_input.val().split(',').filter(Boolean)
if $.inArray(name, current_tags) >= 0 if $.inArray(name, current_tags) >= 0

View File

@@ -1,10 +1,10 @@
class TagSanitizer class TagSanitizer
DISALLOWED_STRINGS = %w(? < > = /) DISALLOWED_STRINGS = %w[? < > = /]
def sanitize_tag(tag) def sanitize_tag(tag)
tag = tag.dup tag = tag.dup
DISALLOWED_STRINGS.each do |s| DISALLOWED_STRINGS.each do |s|
tag.gsub!(s, '') tag.gsub!(s, "")
end end
tag.truncate(TagSanitizer.tag_max_length) tag.truncate(TagSanitizer.tag_max_length)
end end
@@ -14,7 +14,7 @@ class TagSanitizer
end end
def self.tag_max_length def self.tag_max_length
40 160
end end
end end