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

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

They could be queued posts or users, and the notice should reflect that properly.

diff --git a/app/jobs/scheduled/pending_flags_reminder.rb b/app/jobs/scheduled/pending_flags_reminder.rb
deleted file mode 100644
index da38e2b..0000000
--- a/app/jobs/scheduled/pending_flags_reminder.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-require_dependency 'flag_query'
-
-module Jobs
-
-  class PendingFlagsReminder < Jobs::Scheduled
-    every 1.hour
-
-    attr_reader :sent_reminder
-
-    def execute(args)
-      @sent_reminder = false
-
-      if SiteSetting.notify_about_flags_after > 0
-        reviewable_ids = Reviewable
-          .pending
-          .default_visible
-          .where('latest_score < ?', SiteSetting.notify_about_flags_after.to_i.hours.ago)
-          .order('id DESC')
-          .pluck(:id)
-
-        if reviewable_ids.size > 0 && self.class.last_notified_id < reviewable_ids[0]
-          usernames = active_moderator_usernames
-          mentions = usernames.size > 0 ? "@#{usernames.join(', @')} " : ""
-
-          @sent_reminder = PostCreator.create(
-            Discourse.system_user,
-            target_group_names: Group[:moderators].name,
-            archetype: Archetype.private_message,
-            subtype: TopicSubtype.system_message,
-            title: I18n.t('flags_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)
-          ).present?
-
-          self.class.last_notified_id = reviewable_ids[0]
-        end
-      end
-    end
-
-    def self.last_notified_id
-      $redis.get(last_notified_key).to_i
-    end
-
-    def self.last_notified_id=(arg)
-      $redis.set(last_notified_key, arg)
-    end
-
-    def self.last_notified_key
-      "last_notified_reviewable_id".freeze
-    end
-
-    def self.clear_key
-      $redis.del(last_notified_key)
-    end
-
-    def active_moderator_usernames
-      User.where(moderator: true)
-        .human_users
-        .order('last_seen_at DESC')
-        .limit(3)
-        .pluck(:username)
-    end
-
-  end
-
-end
diff --git a/app/jobs/scheduled/pending_reviewables_reminder.rb b/app/jobs/scheduled/pending_reviewables_reminder.rb
new file mode 100644
index 0000000..30a3ec7
--- /dev/null
+++ b/app/jobs/scheduled/pending_reviewables_reminder.rb
@@ -0,0 +1,65 @@
+require_dependency 'flag_query'
+
+module Jobs
+
+  class PendingReviewablesReminder < Jobs::Scheduled
+    every 1.hour
+
+    attr_reader :sent_reminder
+
+    def execute(args)
+      @sent_reminder = false
+
+      if SiteSetting.notify_about_flags_after > 0
+        reviewable_ids = Reviewable
+          .pending
+          .default_visible
+          .where('latest_score < ?', SiteSetting.notify_about_flags_after.to_i.hours.ago)
+          .order('id DESC')
+          .pluck(:id)
+
+        if reviewable_ids.size > 0 && self.class.last_notified_id < reviewable_ids[0]
+          usernames = active_moderator_usernames
+          mentions = usernames.size > 0 ? "@#{usernames.join(', @')} " : ""
+
+          @sent_reminder = PostCreator.create(
+            Discourse.system_user,
+            target_group_names: Group[:moderators].name,
+            archetype: Archetype.private_message,
+            subtype: TopicSubtype.system_message,
+            title: I18n.t('reviewables_reminder.subject_template', count: reviewable_ids.size),
+            raw: mentions + I18n.t('reviewables_reminder.submitted', count: SiteSetting.notify_about_flags_after, base_path: Discourse.base_path)
+          ).present?
+
+          self.class.last_notified_id = reviewable_ids[0]
+        end
+      end
+    end
+
+    def self.last_notified_id
+      $redis.get(last_notified_key).to_i
+    end
+
+    def self.last_notified_id=(arg)
+      $redis.set(last_notified_key, arg)
+    end
+
+    def self.last_notified_key
+      "last_notified_reviewable_id".freeze
+    end
+
+    def self.clear_key
+      $redis.del(last_notified_key)
+    end
+
+    def active_moderator_usernames
+      User.where(moderator: true)
+        .human_users
+        .order('last_seen_at DESC')
+        .limit(3)
+        .pluck(:username)
+    end
+
+  end
+
+end
diff --git a/app/views/pending_flags_mailer/notify.html.erb b/app/views/pending_flags_mailer/notify.html.erb
deleted file mode 100644
index 940fc6c..0000000
--- a/app/views/pending_flags_mailer/notify.html.erb
+++ /dev/null
@@ -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>
diff --git a/app/views/pending_flags_mailer/notify.text.erb b/app/views/pending_flags_mailer/notify.text.erb
deleted file mode 100644
index ca10b09..0000000
--- a/app/views/pending_flags_mailer/notify.text.erb
+++ /dev/null
@@ -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' %>
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index d3d6ba8..0376302 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2221,13 +2221,13 @@ en:
       same_ip_address: "Same IP address (%{ip_address}) as other users"
       inactive_user: "Inactive user"
 
-  flags_reminder:
-    flags_were_submitted:
-      one: "Flags were submitted over 1 hour ago. [Please review them](%{base_path}/admin/flags)."
-      other: "Flags were submitted over %{count} hours ago. [Please review them](%{base_path}/admin/flags)."
+  reviewables_reminder:
+    submitted:
+      one: "Items were submitted over 1 hour ago. [Please review them](%{base_path}/review)."
+      other: "Items were submitted over %{count} hours ago. [Please review them](%{base_path}/review)."
     subject_template:
-      one: "1 flag waiting to be handled"
-      other: "%{count} flags waiting to be handled"
+      one: "1 item needs to be reviewed"
+      other: "%{count} items need to be reviewed"
 
   unsubscribe_mailer:
     title: "Unsubscribe Mailer"
diff --git a/spec/jobs/pending_flags_reminder_spec.rb b/spec/jobs/pending_flags_reminder_spec.rb
deleted file mode 100644
index 69f3c69..0000000
--- a/spec/jobs/pending_flags_reminder_spec.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-require 'rails_helper'
-
-describe Jobs::PendingFlagsReminder do
-  let(:job) { described_class.new }
-
-  def create_flag(created_at)
-    PostActionCreator.create(Fabricate(:user), Fabricate(:post), :spam, created_at: created_at).reviewable
-  end
-
-  def execute
-    job.tap { job.execute({}) }
-  end
-
-  it "doesn't notify when there are no flags" do
-    expect(execute.sent_reminder).to eq(false)
-  end
-
-  context "notify_about_flags_after is 0" do

[... diff too long, it was truncated ...]

GitHub sha: 76669bb5

This commit has been mentioned on Discourse Meta. There might be relevant details there: