-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with linked proposals not displaying for private authors
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
app/views/decidim/proposals/proposals/_linked_proposals.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<div class="card card--action card--list"> | ||
<% resources.each do |proposal| %> | ||
<div class="card--list__item"> | ||
<div class="card--list__text"> | ||
<%= link_to resource_locator(proposal).path do %> | ||
<%= icon "proposals", class: "card--list__icon", remove_icon_class: true %> | ||
<% end %> | ||
<div> | ||
<%= link_to resource_locator(proposal).path, class: "card__link" do %> | ||
<h5 class="card--list__heading"><%== decidim_html_escape(present(proposal).title) %></h5> | ||
<% end %> | ||
<% present(proposal) do |proposal| %> | ||
<% if proposal.author %> | ||
<div class="author"> | ||
<span class="author__avatar"> | ||
<%= image_tag proposal.author.avatar_url %> | ||
</span> | ||
<span class="author__name"> | ||
<strong><%= proposal.author.name %></strong> | ||
<%= proposal.author.nickname %> | ||
</span> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% if !current_settings.try(:votes_hidden?) && !proposal.component.current_settings.votes_hidden? && | ||
proposal.component.current_settings.votes_enabled? %> | ||
<div class="card--list__data"> | ||
<span class="card--list__data__number"> | ||
<%= proposal.votes.size %> | ||
</span> <%= t(".proposal_votes", count: proposal.votes.size) %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Accountability", type: :system do | ||
include_context "with a component" | ||
|
||
let(:manifest_name) { "accountability" } | ||
|
||
describe "show" do | ||
let!(:result) { create(:result, component: component) } | ||
let(:path) { decidim_participatory_process_accountability.result_path(id: result.id, participatory_process_slug: participatory_process.slug, component_id: component.id) } | ||
|
||
context "when a result has linked proposals with private authors" do | ||
let(:proposals_component) { create(:proposal_component, participatory_space: participatory_process) } | ||
let(:proposal) { create(:proposal, :accepted, component: proposals_component, users: [proposal_author]) } | ||
let(:proposal_author) { create(:user, :confirmed, organization: organization) } | ||
|
||
before do | ||
result.link_resources([proposal], "included_proposals") | ||
end | ||
|
||
it "renders the linked proposals without the author" do | ||
visit path | ||
expect(page).to have_content(translated(result.title)) | ||
page.scroll_to(find(".section-heading", text: "Proposals included in this result".upcase)) | ||
|
||
expect(page).to have_css(".card--list__item", text: translated(proposal.title)) | ||
expect(page).not_to have_css(".card--list__item .author") | ||
end | ||
end | ||
end | ||
end |