diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index c34adc0fbae..d190fb95b68 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -45,7 +45,7 @@ jobs: bundler-cache: true - name: erb-lint - uses: tk0miya/action-erblint@eda368e7a0d8a0e71c475bb7cc65d0d612e5148c + uses: tk0miya/action-erblint@b6e537f4616e4fa7a9eef209ca34ca944e1440dd with: use_bundler: true reporter: github-pr-check diff --git a/Gemfile.lock b/Gemfile.lock index 587fe1f539e..dccb43030ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -499,7 +499,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.3.2) + rexml (3.3.3) strscan rollout (2.4.3) rspec-core (3.13.0) diff --git a/app/helpers/tag_sets_helper.rb b/app/helpers/tag_sets_helper.rb index 83772895e25..35e83290edf 100644 --- a/app/helpers/tag_sets_helper.rb +++ b/app/helpers/tag_sets_helper.rb @@ -64,7 +64,7 @@ def nomination_status(nomination=nil) end def nomination_tag_information(nominated_tag) - tag_object = nominated_tag.type.gsub(/Nomination/, '').constantize.find_by_name(nominated_tag.tagname) + tag_object = Tag.find_by(name: nominated_tag.tagname) status = "nonexistent" tooltip = ts("This tag has never been used before. Check the spelling!") title = ts("nonexistent tag") diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 8464e9ddaca..fb597dc814d 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -9,7 +9,7 @@ config.traces_sampler = lambda do |sampling_context| next sampling_context[:parent_sampled] unless sampling_context[:parent_sampled].nil? - rack_env = sampling_context[:env] + rack_env = sampling_context[:env] || {} rate_from_nginx = Float(rack_env["HTTP_X_SENTRY_RATE"], exception: false) return rate_from_nginx if rate_from_nginx return 0.01 if Rails.env.production? diff --git a/docker-compose.yml b/docker-compose.yml index e37dea781ab..d44e9e554dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -85,6 +85,9 @@ services: - redis - es - mc + # Make `docker compose attach web` work for debugging + stdin_open: true + tty: true chrome: profiles: - test diff --git a/features/step_definitions/tag_set_steps.rb b/features/step_definitions/tag_set_steps.rb index 7c2d05e074b..ec3082682d5 100644 --- a/features/step_definitions/tag_set_steps.rb +++ b/features/step_definitions/tag_set_steps.rb @@ -1,4 +1,12 @@ -# encoding: utf-8 +Given "a nominated tag set {string} with a tag nomination in the wrong category" do |tag_set_name| + pseud = FactoryBot.create(:pseud, user: FactoryBot.create(:user, login: "tagsetter")) + owned_tag_set = FactoryBot.create(:owned_tag_set, title: tag_set_name, owner: pseud) + tag_set_nomination = FactoryBot.create(:tag_set_nomination, pseud: pseud, owned_tag_set: owned_tag_set) + FactoryBot.create(:relationship, name: "rel tag") + invalid_nom = tag_set_nomination.fandom_nominations.build(tagname: "rel tag") # intentional mismatch in tag category + invalid_nom.save(validate: false) +end + When /^I follow the add new tag ?set link$/ do step %{I follow "New Tag Set"} end diff --git a/features/support/paths.rb b/features/support/paths.rb index 237112b7b48..cade8257446 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -263,6 +263,8 @@ def path_to(page_name) edit_tag_set_path(OwnedTagSet.find_by(title: $1)) when /^the "(.*)" tag ?set page$/i tag_set_path(OwnedTagSet.find_by(title: $1)) + when /^the "(.*)" tag ?set nominations page$/i + tag_set_nominations_path(OwnedTagSet.find_by(title: Regexp.last_match(1))) when /^the Open Doors tools page$/i opendoors_tools_path when /^the Open Doors external authors page$/i diff --git a/features/tag_sets/tag_set_nominations.feature b/features/tag_sets/tag_set_nominations.feature index 043552534d3..e98fe44b0c8 100644 --- a/features/tag_sets/tag_set_nominations.feature +++ b/features/tag_sets/tag_set_nominations.feature @@ -232,3 +232,34 @@ Feature: Nominating and reviewing nominations for a tag set And I submit Then I should see "The tag Veronica Mars is already in the archive as a Character tag. (All tags have to be unique.) Try being more specific, for instance tacking on the medium or the fandom." + Scenario: If a tag was nominated as another type of tag, "My Nominations" and "Review Nominations" can still be accessed + Given a nominated tag set "bad" with a tag nomination in the wrong category + And I am logged in as "tagsetter" + And I go to the "bad" tag set page + # preexisting non-canonical tag + When I follow "My Nominations" + Then I should see "My Nominations for bad" + And I should see "rel tag" + When I go to the "bad" tag set nominations page + Then I should see "Fandoms (1 left to review)" + And I should see "rel tag" + # canonical tag + When the tag "rel tag" is canonized + And I go to the "bad" tag set page + When I follow "My Nominations" + Then I should see "My Nominations for bad" + And I should see "rel tag" + When I go to the "bad" tag set nominations page + Then I should see "Fandoms (1 left to review)" + And I should see "rel tag" + # synonym tag + When the tag "rel tag" is decanonized + And a canonical relationship "canon tag" + And a synonym "rel tag" of the tag "canon tag" + And I go to the "bad" tag set page + When I follow "My Nominations" + Then I should see "My Nominations for bad" + And I should see "rel tag" + When I go to the "bad" tag set nominations page + Then I should see "Fandoms (1 left to review)" + And I should see "rel tag (canon tag)"