Rename Warning class

Description

Our current code uses a class named Warning for Archive warning tags. This class will need to be renamed ArchiveWarning to avoid conflicts with newer versions of Ruby. We would like this change to be made in a separate pull request prior to upgrading Ruby.

Unfortunately, there are numerous places in our code where we use the tag class names to create user-facing text. For example, we call tag_type.classify.pluralize to create headings in this tag set partial. In this case, renaming the Warning class would have the unwanted side effect of changing the user-facing text from "Warnings" to "ArchiveWarnings".

Fortunately, (pull request) has a solution for dealing with situations where the preferred display text does not match the class name. Much like the label_name for the Freeform class was set to "Additional Tags", we'd like to set the label_name for the ArchiveWarning class to "Warnings". Then we'd like to use this method in our views as much as possible.

It's also important to ensure that class names used in the HTML don't get changed from warning/warnings to archivewarning/archivewarnings/archive_warning/archive_warnings/etc. The existing class names get used a lot by Archive users who create site skins (e.g. some people want to hide things related to warnings, whereas other users want to highlight warnings).

Reference

A branch containing an initial pass at this is available on GitHub.

There is also an earlier pull request that predates the introduction of the label_name method.

Testing notes

This affects the CSS classes used on warning-related areas, so please create a site skin with the following CSS and use it while testing:

If you see anything highlighted or outlined in pink, please comment with a screenshot. (Feel free to change it to some other color that is more noticeable to you, but make sure to leave the !important.)

Testing notes II

While wearing the hotpink site skin:

  • Viewing works

    • Links to Warnings on work metas and work blurbs work.

    • Work blurbs show the correct symbols for Warnings.

    • Share a work: embed code should have warnings.

    • Tag RSS feed: links to Warnings show up and work.

    • Download a work (any format): links to Warnings show up and work.

    • Turn on/off preference: "Hide warnings (you can still choose to show them)." Check that this option behaves correctly on work metas (top of each work) and work blurbs (in search results). The links "Show warnings"/"Hide warnings" should work.

  • Bookmark filters

    • Include every tag type using checkboxes (checkboxes remain checked after "Sort and Filter")

    • Exclude every tag type using checkboxes (checkboxes remain checked after "Sort and Filter")

    • Warnings are aggregated correctly on the filters (breakdown: CCNA has how many, NAWA has how many, etc., should be sensible numbers).

  • Work filters

    • Include every tag type using checkboxes (checkboxes remain checked after "Sort and Filter")

    • Exclude every tag type using checkboxes (checkboxes remain checked after "Sort and Filter")

    • Warnings are aggregated correctly on the filters (breakdown: CCNA has how many, NAWA has how many, etc., should be sensible numbers).

  • Posting and editing works

    • Post a work without a warning. Expect the "Warning is missing" error. With and without preview.

    • Post a work with warnings. Warnings should show. With and without preview.

    • Edit a work's warnings ("Edit"). With and without preview.

    • Edit a work's warnings ("Edit Tags"). With and without preview.

    • Edit a work's warnings ("Edit Tags", as admin). With and without preview.

    • Edit/orphan/delete multiple works. The section "Your edits will be applied to all of the following works:" has the correct warnings, links work.

  • Importing works

    • Import a work without specifying warnings. Expect the work to have "Choose Not To Use Archive Warnings".

    • Import a work while specifying warnings. Expect the work to have the specified warnings.

    • Import a work with "Warnings: Underage" in the body, and without specifying warnings on the import form. Expect the work to have the "Underage" warning.

    • Import a work with "Warnings: WTF" in the body, and without specifying warnings on the import form. Expect the work to have the "Creator Chose Not To Use Archive Warnings" warning, but not a "WTF" warning.

    • (Open Doors) Import a work with different warnings through the API

  • Other bookmarkable types

    • Series have the right warnings (warnings from all the works in it).

    • Bookmark an external work with various kinds of tags: the tags should show up. External works don't have warnings however.

    • Bookmark search: search for bookmarked items of a specific type (Work/Series/External Work) that have certain warnings.

  • Tag wrangling

    • Quick: wrangle as you would normally. Anything looks misspelled?

    • Edit a tag: "Category" shows tag type (singular). "Warning" for warnings.

    • Edit a tag: Expect "This is the official name for the Warning".

    • Edit a tag: Cannot change name of warnings.

    • New tag: Options spelled correctly? (Note: Need to be logged in as admin to see Warning option.)

  • Subscriptions

    • Subscription emails show warnings for new chapters of subbed works.

    • Subscription emails show warnings for new works of subbed series.

    • Subscription emails show warnings for new works/chapters of subbed users.

  • Tag sets and challenges

    • Create a tag set with canonical warnings.

    • Create a tag set with noncanonical warnings (these exist because of an unrelated bugs, e.g. "IT HAS WAY TOO MUCH SEX RUN FOR YOUR LIFE" on staging).

    • Add a warning to an existing tag set.

    • Remove a warning from an existing tag set.

    • With a prompt meme using a tag set, expect the sign-up form to have only the warnings from the tag set, and that you can select them.

    • Include warnings on gift exchange sign-ups, run matching and expect matches. Also participants can expect to receive emails containing their assignment, including warning tags.

    • Include warnings on gift exchange sign-ups (where the exchange uses a tag set containing warnings), run matching and expect matches.

    • In a gift exchange, enable Optional Tags (set count as warnings) in request and offers.

Environment

None

Status

Assignee

Matt Sears

Reporter

Sarken

Roadmap

Misc

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Hard

Required Access Level

None

Milestone

Internal 0.9
Configure