Tag nominations of existing canonical tags give 500 error if a site admin edits the tag's name (e.g. to remove a suffix)

Description

Steps to reproduce

Note: We're using a character tag here and simulating the process of performing a suffix swap. However, this problem could occur with any type of tag and when making any sort of edit to the tag name.

  1. Log in as a wrangler

  2. Post a work with a new character tag like "Somebody Who Once Told Me - Character"

  3. Edit the tag you just made to canonize it and put it in a fandom, e.g. Testing

  4. Create a tag set that is accepting nominations for character tags

  5. Nominate the tag you just canonized (do not simply add the tag to the tag set – this bug is with nominations specifically)

  6. Log out

  7. Log in as an admin

  8. Go to the edit page for your tag, e.g. https://test.archiveofourown.org/tags/Somebody%20Who%20Once%20Told%20Me%20-%20Character/edit

  9. Edit the "Name" field to remove the " - Character" bit (and press "Save changes")

  10. Log out of your admin account

  11. Log back in as the tag wrangler

  12. Attempt to access your tag nomination, e.g. https://test.archiveofourown.org/tag_sets/496/nominations/6703, or your tag set's page for reviewing nominations, e.g. https://test.archiveofourown.org/tag_sets/496/nominations/

What should happen

Those pages should load. The nominated tag should still be exactly as the nominator wrote it ("Somebody Who Once Told Me - Character").

What happens instead

500 error! For the nominations review page, the error might not happen immediately, depending on the number of nominations (because the broken nomination might not be randomly selected for display).

The error happens because the TagNomination doesn't get updated in the database. It is still tagname: "Somebody Who Once Told Me - Character", canonical: true, exists: true, parent: true when those last three things should be false, and so we error when looking up the tag object in the nomination_tag_information(nominated_tag) method of the tag sets helper: https://github.com/otwcode/otwarchive/blob/9e5741ddcaacc9cc8ca9fe367bf4921fb99c78af/app/helpers/tag_sets_helper.rb#L66

Activity

Show:

Brian Austin 
October 5, 2024 at 2:12 PM

Everything went fine on my end! I used another browser to log in as an admin, so I didn’t have any weird redirect stuff. Logging in/out does… really weird stuff with redirects, so I suspect that is what you ran into

Sarken 
October 5, 2024 at 8:53 AM

Taking my previous comment back! The URL nomination was wrong and the right one didn’t 500.

I have no idea how I ended up at the other nomination URL. After I made my nomination in tag set 721, not 496, I left the page open in my regular browser window while I renamed the tag in a private window and then refreshed and got the 500.

Regardless, when I started things over with a new nomination, it was fine – no 500 error after renaming the tag.

Sarken 
October 5, 2024 at 12:50 AM

I posted a work with the tag AO3-5538 Character - Character, nominated the tag, removed the - Character suffix.

The page for reviewing nominations as a mod doesn’t error and does show the tag as AO3-5538 Character - Character. However, I still get a 500 error when trying to access my nomination directly (https://test.archiveofourown.org/tag_sets/496/nominations/6703)

The error is

ActionView::Template::Error

Brian Austin 
August 2, 2024 at 9:57 PM

Some additional notes from :

AO3-5538 (error in nominations after tag rename) happens because the after_save :update_tag_nominations on Tag is looking for the TagNomination by the new name, which obviously doesn't update the nomination with the old name. Should be a somewhat simple fix since the old name is available in the callback.

DeployedToBeta

Details

Assignee

Reporter

Roadmap

Tags
Tag Sets

Priority

Affects versions

Fix versions

Components

BackEnd

Difficulty

Required Access Level

Admin
Tag Wrangler

Milestone

Sentry

Created September 29, 2018 at 2:40 AM
Updated October 5, 2024 at 8:54 PM
Resolved October 5, 2024 at 8:54 PM