FIX: Don't refer to pending review items as flags

They could be queued posts or users, and the notice should reflect that
properly.
This commit is contained in:
Robin Ward 2019-04-01 14:46:56 -04:00
parent 6470c85fda
commit 76669bb5a6
5 changed files with 10 additions and 48 deletions

View File

@ -2,7 +2,7 @@ require_dependency 'flag_query'
module Jobs module Jobs
class PendingFlagsReminder < Jobs::Scheduled class PendingReviewablesReminder < Jobs::Scheduled
every 1.hour every 1.hour
attr_reader :sent_reminder attr_reader :sent_reminder
@ -27,8 +27,8 @@ module Jobs
target_group_names: Group[:moderators].name, target_group_names: Group[:moderators].name,
archetype: Archetype.private_message, archetype: Archetype.private_message,
subtype: TopicSubtype.system_message, subtype: TopicSubtype.system_message,
title: I18n.t('flags_reminder.subject_template', count: reviewable_ids.size), title: I18n.t('reviewables_reminder.subject_template', count: reviewable_ids.size),
raw: mentions + I18n.t('flags_reminder.flags_were_submitted', count: SiteSetting.notify_about_flags_after, base_path: Discourse.base_path) raw: mentions + I18n.t('reviewables_reminder.submitted', count: SiteSetting.notify_about_flags_after, base_path: Discourse.base_path)
).present? ).present?
self.class.last_notified_id = reviewable_ids[0] self.class.last_notified_id = reviewable_ids[0]

View File

@ -1,29 +0,0 @@
<p>
<%= t 'flags_reminder.flags_were_submitted', count: @hours %>
<a href="<%= Discourse.base_url + '/admin/flags' %>"><%= t 'flags_reminder.please_review' %></a>
</p>
<table style="border-collapse: collapse; border-spacing: 0;">
<% @posts.each do |post| %>
<tr style="border-top: 1px solid #e9e9e9;">
<td style="width: 25px; padding: 8px 0 0 0; text-align: center; vertical-align: top;">
<a href='<%= Discourse.base_url + "/admin/users/#{post[:user].username.downcase}" %>'>
<img width="25" height="25" src="<%= Discourse.base_url + post[:user].avatar_template.gsub("{size}", "45") %>" title="<%= post[:user].username %>">
</a>
</td>
<td style="padding: 8px; word-wrap: break-word; vertical-align: top;">
<h3 style="margin: 0 !important;"><%= link_to post[:title], post[:url] %></h3>
<p style="margin: 0 2px;"><%= raw post[:excerpt] %></p>
</td>
</tr>
<tr style="border-bottom: 1px solid #e9e9e9;">
<td colspan=2 style="padding: 0px 0px 5px 33px; vertical-align: top;"><%= raw post[:html_reason_counts] %></td>
</tr>
<% end %>
</table>
<div class='footer'>
<p>
<%= t 'flags_reminder.how_to_disable' %>
</p>
</div>

View File

@ -1,9 +0,0 @@
<%=t 'flags_reminder.flags_were_submitted', count: @hours %> <%=t 'flags_reminder.please_review' %>
<%= Discourse.base_url + '/admin/flags' %>
<% @posts.each do |post| %>
- <%= post[:title] %>: <%=t 'flags_reminder.post_number' %> <%= post[:post_number] %> - <%= post[:reason_counts] %>
<% end %>
<%=t 'flags_reminder.how_to_disable' %>

View File

@ -2221,13 +2221,13 @@ en:
same_ip_address: "Same IP address (%{ip_address}) as other users" same_ip_address: "Same IP address (%{ip_address}) as other users"
inactive_user: "Inactive user" inactive_user: "Inactive user"
flags_reminder: reviewables_reminder:
flags_were_submitted: submitted:
one: "Flags were submitted over 1 hour ago. [Please review them](%{base_path}/admin/flags)." one: "Items were submitted over 1 hour ago. [Please review them](%{base_path}/review)."
other: "Flags were submitted over %{count} hours ago. [Please review them](%{base_path}/admin/flags)." other: "Items were submitted over %{count} hours ago. [Please review them](%{base_path}/review)."
subject_template: subject_template:
one: "1 flag waiting to be handled" one: "1 item needs to be reviewed"
other: "%{count} flags waiting to be handled" other: "%{count} items need to be reviewed"
unsubscribe_mailer: unsubscribe_mailer:
title: "Unsubscribe Mailer" title: "Unsubscribe Mailer"

View File

@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
describe Jobs::PendingFlagsReminder do describe Jobs::PendingReviewablesReminder do
let(:job) { described_class.new } let(:job) { described_class.new }
def create_flag(created_at) def create_flag(created_at)