diff --git a/config/config.yml b/config/config.yml index 149a6859280..56e497e2236 100644 --- a/config/config.yml +++ b/config/config.yml @@ -100,7 +100,7 @@ TITLE_MIN: 1 SUMMARY_MAX: 1250 NOTES_MAX: 5000 COMMENT_MAX: 10000 -TAG_MAX: 100 +TAG_MAX: 150 CONTENT_MIN: 10 CONTENT_MAX: 510000 CONTENT_MAX_DISPLAYED: 500000 diff --git a/db/migrate/20241221141135_increase_tag_name_limit.rb b/db/migrate/20241221141135_increase_tag_name_limit.rb new file mode 100644 index 00000000000..ee4d36e4602 --- /dev/null +++ b/db/migrate/20241221141135_increase_tag_name_limit.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IncreaseTagNameLimit < ActiveRecord::Migration[7.0] + uses_departure! if Rails.env.staging? || Rails.env.production? + + def up + change_column :tags, :name, :string, limit: 150 + end + + def down + # This is only safe to run if no users have created tags with names > 100 characters. + # Otherwise, tags wil need to be renamed first and _then_ this migration torn down. + change_column :tags, :name, :string, limit: 100 + end +end diff --git a/features/works/work_create.feature b/features/works/work_create.feature index 65c3cbb900a..b2f1369df5c 100755 --- a/features/works/work_create.feature +++ b/features/works/work_create.feature @@ -202,9 +202,9 @@ Feature: Create Works And I press "Preview" Then I should see "badcoauthor cannot be listed as a co-creator" When I fill in "pseud_byline" with "coauthor" - And I fill in "Additional Tags" with "this is a very long tag more than one hundred characters in length how would this normally even be created" + And I fill in "Additional Tags" with "this is a very long tag more than one hundred fifty characters in length how would this normally even be created plus some extra words to pad this out 1" And I press "Preview" - Then I should see "try using less than 100 characters or using commas to separate your tags" + Then I should see "try using less than 150 characters or using commas to separate your tags" When I fill in "Additional Tags" with "this is a shorter tag" And I press "Preview" Then I should see "Draft was successfully created" diff --git a/public/help/relationships-help.html b/public/help/relationships-help.html index b334aa83449..f8ed86c3852 100644 --- a/public/help/relationships-help.html +++ b/public/help/relationships-help.html @@ -2,5 +2,5 @@
(For more information, see the Tags on the Archive FAQ.)
-The relationships in your work. Full names are preferred (for example, "Mickey Mouse/Minnie Mouse" or "Rodney McKay & John Sheppard"). You may list more than one relationship, separated by commas. Please note that all user-created tags must be 100 characters or less; if your work contains a threesome (or a larger poly group) you may want to use first names only to avoid going over the character limit.
+The relationships in your work. Full names are preferred (for example, "Mickey Mouse/Minnie Mouse" or "Rodney McKay & John Sheppard"). You may list more than one relationship, separated by commas. Please note that all user-created tags must be 150 characters or less; if your work contains a threesome (or a larger poly group) you may want to use first names only to avoid going over the character limit.
diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 340c2d87991..b9917313491 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -1,11 +1,12 @@ -# encoding: UTF-8 -require 'spec_helper' +require "spec_helper" describe Tag do after(:each) do User.current_user = nil end + it { is_expected.not_to allow_values("", "a" * 151).for(:name) } + context "checking count caching" do before(:each) do # Set the minimal amount of time a tag can be cached for. @@ -66,7 +67,7 @@ end it "Writes to the database do not happen immediately" do - (1..40 * ArchiveConfig.TAGGINGS_COUNT_CACHE_DIVISOR - 1).each do |try| + (1..(40 * ArchiveConfig.TAGGINGS_COUNT_CACHE_DIVISOR) - 1).each do |try| @fandom_tag.taggings_count = try @fandom_tag.reload expect(@fandom_tag.taggings_count_cache).to eq 0 @@ -161,13 +162,6 @@ def expect_tag_update_flag_in_redis_to_be(flag) expect(tag.save).to be_truthy end - it "should not be valid if too long" do - tag = Tag.new - tag.name = "a" * 101 - expect(tag.save).not_to be_truthy - expect(tag.errors[:name].join).to match(/too long/) - end - context "tags using restricted characters should not be saved" do [ "bad, tag",