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-6058 Hide byline of unrevealed work in notes of child related work #3911

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/views/downloads/_download_preface.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@
<ul>
<% related_works.each do |work| %>
<li>
<% relation_text = work.translation ?
"A translation of %{work_link} by %{author_link}" :
"Inspired by %{work_link} by %{author_link}"
%>
<% if work.parent.unrevealed? then
Copy link
Collaborator

Choose a reason for hiding this comment

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

This won't quite work. The downloads currently show either:

  • A translation of %{work_link} by %{author_link}
  • Inspired by %{work_link} by %{author_link}

What we're trying to do is -- for unrevealed works -- replace just the %{work_link} by %{author_link} portion with a work in an unrevealed collection.

But what you have will write a work in an unrevealed collection without the words A translation of or Inspired by in front of it.

(Also, minor code style note: we typically don't use then.)

So basically we'd need to divide it up more like:

work_info = if work.parent.unrevealed?
              "a work in an unrevealed collection"
            else
              "%{work_link} by %{author_link}"
            end

relation_text = if work.translation
                  "A translation of %{work_info}."
                else
                  "Inspired by %{work_info}."
                end

relation_text = "a work in an unrevealed collection."
else
relation_text = work.translation ?
"A translation of %{work_link} by %{author_link}" :
"Inspired by %{work_link} by %{author_link}"
end %>
<% work_link = link_to work.parent.title.html_safe, url_for(work.parent) %>
<% author_link = byline(work.parent, visibility: 'public', only_path: false) %>

Expand Down
2 changes: 2 additions & 0 deletions app/views/works/_work_header_notes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

<% if related_work.parent.is_a?(ExternalWork) %>
<%= link_to related_work.parent.title.html_safe, related_work.parent %> by <%= byline(related_work.parent) %>.
<% elsif related_work.parent.unrevealed? %>
<%= ts("a work in an unrevealed collection.") %>
<% elsif related_work.parent.restricted? && !logged_in? %>
<%= ts("[Restricted Work] by") %> <%= byline(related_work.parent) %>. <%= ts("Log in to view.") %>
<% else %>
Expand Down
15 changes: 15 additions & 0 deletions features/works/work_related.feature
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,18 @@ Scenario: When a user is notified that a co-authored work has been inspired by a
And I should not see "A work in an unrevealed collection"
And I should not see "Worldbuilding Translated by translator"
And I should not see "From English to Deutsch"

Scenario: A work that is inspired by a work in an unrevealed collection does not list the title or creator of the unrevealed work in its notes
Given a hidden collection "Hidden"
And I have related works setup
When I am logged in as "inspiration"
And I add the work "Worldbuilding" to the collection "Hidden"
And I post a related work as remixer
When I view the work "Followup"
Then I should not see "Worldbuilding"
And I should not see "inspiration"
And I should see "Inspired by a work in an unrevealed collection."
And I follow "HTML"
Then I should not see "Worldbuilding"
And I should not see "inspiration"
And I should see "a work in an unrevealed collection."