Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6688 Make accidental history deletions less likely #4759

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

forceofcalm
Copy link
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-6688

Purpose

What does this PR do?

Adds a confirmation page for history deletion instead of an alert pop-up.
Updates language from "Clear History" to "Clear Entire History".

Testing Instructions

  1. Log in
  2. Have some works in your history
  3. Go to History
  4. Click "Clear Entire History"
  5. Be redirected to new confirmation page
  6. Make sure History was not cleared yet
  7. Return to confirmation page
  8. Click "Yes, Clear Entire History"
  9. Have History be cleared

Credit

calm (they/them)

@sarken sarken changed the title AO3 6688 Make accidental history deletions less likely AO3-6688 Make accidental history deletions less likely Mar 2, 2024
features/other_a/reading.feature Outdated Show resolved Hide resolved
@@ -50,6 +50,9 @@ def clear
redirect_to user_readings_path(current_user)
end

def confirm_clear
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tests are failing in part because you need to add this to config/routes.rb as well. After that, you'll probably still need to update the tests to take into account the additional steps of clicking the "Yes, Clear Entire History" button on the new page.

@forceofcalm
Copy link
Contributor Author

Hey, I'm trying to resolve these failing tests, but I think I'm mostly just digging a deeper hole into things I don't understand. Would I be able to get some guidance, please?

Copy link
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comments should address the test failures.

<h2 class="heading"><%= t("Clear Entire History") %></h2>

<!--main content-->
<%= form_for(@readings, html: { method: "post", action: "clear", class: "simple destroy" }) do |f| %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like form_for doesn't like getting passed a collection of records. Based on the Rails guide, I think we should be using form_with in combination with a symbol instead. Solely based on the docs, untested:

Suggested change
<%= form_for(@readings, html: { method: "post", action: "clear", class: "simple destroy" }) do |f| %>
<%= form_with(model: :reading, method: :post, url: { action: "clear" }, class: "simple destroy") do |f| %>

@@ -1,29 +1,29 @@
<!--Descriptive page name, messages and instructions-->
<h2 class="heading"><%= ts('History') %></h2>
<h2 class="heading"><%= t("History") %></h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internationalizing a page is not as simple as only replacing ts with t. The gist is that you need to use a locale key inside t() and then place the English text into the locale file.

Suggested change
<h2 class="heading"><%= t("History") %></h2>
<h2 class="heading"><%= t(".page_heading") %></h2>

And in config/locales/views/en.yml:

readings:
  index:
    page_heading: History

See the wiki page for I18n for more in-depth information and examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants