From af149c813efd86a0b98bfdcae5dfc094f51201fb Mon Sep 17 00:00:00 2001 From: vagrant Date: Sun, 25 Oct 2020 22:47:46 +0000 Subject: [PATCH 1/7] A related work should not break anonymity --- app/views/works/_work_header_notes.html.erb | 2 ++ features/works/work_related.feature | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/views/works/_work_header_notes.html.erb b/app/views/works/_work_header_notes.html.erb index bc35b1a2f84..071581f9666 100644 --- a/app/views/works/_work_header_notes.html.erb +++ b/app/views/works/_work_header_notes.html.erb @@ -40,6 +40,8 @@ <%= link_to related_work.parent.title.html_safe, related_work.parent %> by <%= byline(related_work.parent) %>. <% elsif related_work.parent.restricted? && !logged_in? %> <%= ts("[Restricted Work] by") %> <%= byline(related_work.parent) %>. <%= ts("Log in to view.") %> + <% elsif (related_work.parent.unrevealed? ||related_work.parent.anonymous?) %> + <%= ts("Inspired by a work in an unrevealed collection.") %> <% else %> <%= link_to related_work.parent.title.html_safe, related_work.parent %> <%= ts("by") %> <%= byline(related_work.parent) %>. <% end %> diff --git a/features/works/work_related.feature b/features/works/work_related.feature index 3ac546142f1..c9613ae3169 100644 --- a/features/works/work_related.feature +++ b/features/works/work_related.feature @@ -583,3 +583,14 @@ 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 in a hidden collection should not be revealed by posting a related work + 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." \ No newline at end of file From e79f697e890f6afdaea4ae28dc77b2bf52fa12c5 Mon Sep 17 00:00:00 2001 From: zz9pzza Date: Mon, 26 Oct 2020 07:12:01 +0000 Subject: [PATCH 2/7] Follow review --- app/views/works/_work_header_notes.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/works/_work_header_notes.html.erb b/app/views/works/_work_header_notes.html.erb index 071581f9666..cea96f6faa9 100644 --- a/app/views/works/_work_header_notes.html.erb +++ b/app/views/works/_work_header_notes.html.erb @@ -38,10 +38,10 @@ <% 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.") %> - <% elsif (related_work.parent.unrevealed? ||related_work.parent.anonymous?) %> - <%= ts("Inspired by a work in an unrevealed collection.") %> <% else %> <%= link_to related_work.parent.title.html_safe, related_work.parent %> <%= ts("by") %> <%= byline(related_work.parent) %>. <% end %> From 24bbe2b6e21484e222575a6e6614b2be87f0c8eb Mon Sep 17 00:00:00 2001 From: zz9pzza Date: Mon, 26 Oct 2020 08:24:41 +0000 Subject: [PATCH 3/7] Improve senario title --- features/works/work_related.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/works/work_related.feature b/features/works/work_related.feature index c9613ae3169..8d40556dd76 100644 --- a/features/works/work_related.feature +++ b/features/works/work_related.feature @@ -584,7 +584,7 @@ Scenario: When a user is notified that a co-authored work has been inspired by a And I should not see "Worldbuilding Translated by translator" And I should not see "From English to Deutsch" - Scenario: A work in a hidden collection should not be revealed by posting a related work + 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" From 2113c5d501d64fd1f5b368f8abc49290f1ceea18 Mon Sep 17 00:00:00 2001 From: zz9pzza Date: Fri, 25 Dec 2020 22:57:36 +0000 Subject: [PATCH 4/7] Respect unrevealed collections in downloads --- app/views/downloads/_download_preface.html.erb | 11 +++++++---- features/works/work_related.feature | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/views/downloads/_download_preface.html.erb b/app/views/downloads/_download_preface.html.erb index ce2eafcf803..306f8bd9073 100644 --- a/app/views/downloads/_download_preface.html.erb +++ b/app/views/downloads/_download_preface.html.erb @@ -66,10 +66,13 @@
    <% related_works.each do |work| %>
  • - <% relation_text = work.translation ? - "A translation of %{work_link} by %{author_link}" : - "Inspired by %{work_link} by %{author_link}" - %> + <% if work.parent.unrevealed? then + 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) %> diff --git a/features/works/work_related.feature b/features/works/work_related.feature index 8d40556dd76..41601eeabde 100644 --- a/features/works/work_related.feature +++ b/features/works/work_related.feature @@ -593,4 +593,8 @@ Scenario: When a user is notified that a co-authored work has been inspired by a 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." \ No newline at end of file + 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 "Inspired by a work in an unrevealed collection." From 5ae5934d60185aba59b891d80f40fe60e06b5e97 Mon Sep 17 00:00:00 2001 From: zz9pzza Date: Fri, 25 Dec 2020 23:19:03 +0000 Subject: [PATCH 5/7] Fix test --- features/works/work_related.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/works/work_related.feature b/features/works/work_related.feature index 41601eeabde..169c5b0ef92 100644 --- a/features/works/work_related.feature +++ b/features/works/work_related.feature @@ -597,4 +597,4 @@ Scenario: When a user is notified that a co-authored work has been inspired by a And I follow "HTML" 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 should see "a work in an unrevealed collection." From 7d964a105f79e46a4bac5ff855fe44e126f59e34 Mon Sep 17 00:00:00 2001 From: zz9pzza Date: Tue, 29 Dec 2020 16:14:55 +0000 Subject: [PATCH 6/7] Follow recomendations :) --- app/views/downloads/_download_preface.html.erb | 17 ++++++++++------- features/works/work_related.feature | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/views/downloads/_download_preface.html.erb b/app/views/downloads/_download_preface.html.erb index 306f8bd9073..e05821976c8 100644 --- a/app/views/downloads/_download_preface.html.erb +++ b/app/views/downloads/_download_preface.html.erb @@ -66,13 +66,16 @@
      <% related_works.each do |work| %>
    • - <% if work.parent.unrevealed? then - 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_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 %> <% work_link = link_to work.parent.title.html_safe, url_for(work.parent) %> <% author_link = byline(work.parent, visibility: 'public', only_path: false) %> diff --git a/features/works/work_related.feature b/features/works/work_related.feature index 169c5b0ef92..41601eeabde 100644 --- a/features/works/work_related.feature +++ b/features/works/work_related.feature @@ -597,4 +597,4 @@ Scenario: When a user is notified that a co-authored work has been inspired by a 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." + And I should see "Inspired by a work in an unrevealed collection." From 10d0afab666c1b4ac3f300161410e187e1135a27 Mon Sep 17 00:00:00 2001 From: zz9pzza Date: Sun, 3 Jan 2021 18:07:27 +0000 Subject: [PATCH 7/7] fix test --- app/views/downloads/_download_preface.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/downloads/_download_preface.html.erb b/app/views/downloads/_download_preface.html.erb index e05821976c8..9925adab894 100644 --- a/app/views/downloads/_download_preface.html.erb +++ b/app/views/downloads/_download_preface.html.erb @@ -79,7 +79,7 @@ <% work_link = link_to work.parent.title.html_safe, url_for(work.parent) %> <% author_link = byline(work.parent, visibility: 'public', only_path: false) %> - <%= ts(relation_text, work_link: work_link, author_link: author_link).html_safe %> + <%= ts(relation_text, work_link: work_link, author_link: author_link, work_info: work_info).html_safe %>
    • <% end %>