Merge pull request #3154 from consul/backport-check_for_deleted_proposals

[Backport] checks for deleted proposals
This commit is contained in:
Julian Nicolas Herrero
2019-01-09 17:57:01 +01:00
committed by GitHub
4 changed files with 23 additions and 1 deletions

View File

@@ -31,7 +31,13 @@
<td>
<h3>
<%= notification.title %>
<small><%= link_to notification.proposal.title, proposal_path(notification.proposal) %></small>
<small>
<% if notification.proposal.present? %>
<%= link_to notification.proposal.title, proposal_path(notification.proposal) %>
<% else %>
<%= t("admin.stats.proposal_notifications.not_available") %><br>
<% end %>
</small>
</h3>
<p><%= notification.body %></p>
</td>

View File

@@ -1304,6 +1304,7 @@ en:
title: Proposal notifications
total: Total
proposals_with_notifications: Proposals with notifications
not_available: "Proposal not available"
polls:
title: Poll Stats
all: Polls

View File

@@ -1303,6 +1303,7 @@ es:
title: Notificaciones de propuestas
total: Total
proposals_with_notifications: Propuestas con notificaciones
not_available: "Esta propuesta ya no está disponible"
polls:
title: Estadísticas de votaciones
all: Votaciones

View File

@@ -137,6 +137,20 @@ feature 'Stats' do
end
end
scenario "Deleted proposals" do
proposal_notification = create(:proposal_notification)
proposal_notification.proposal.destroy
visit admin_stats_path
click_link "Proposal notifications"
expect(page).to have_css(".proposal_notification", count: 1)
expect(page).to have_content proposal_notification.title
expect(page).to have_content proposal_notification.body
expect(page).to have_content "Proposal not available"
end
end
context "Direct messages" do