FIX: interested users should also be reminded

FIX: interested users should also be reminded

diff --git a/jobs/regular/discourse_post_event/send_reminder.rb b/jobs/regular/discourse_post_event/send_reminder.rb
index b48551b..97aabac 100644
--- a/jobs/regular/discourse_post_event/send_reminder.rb
+++ b/jobs/regular/discourse_post_event/send_reminder.rb
@@ -9,7 +9,10 @@ module Jobs
       raise Discourse::InvalidParameters.new(:reminder) if args[:reminder].blank?
 
       event = DiscoursePostEvent::Event.includes(post: [:topic], invitees: [:user]).find(args[:event_id])
-      invitees = event.invitees.where(status: DiscoursePostEvent::Invitee.statuses[:going])
+      invitees = event.invitees.where(status: [
+        DiscoursePostEvent::Invitee.statuses[:going],
+        DiscoursePostEvent::Invitee.statuses[:interested]
+      ])
 
       already_notified_users = Notification.where(
         read: false,
diff --git a/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb b/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb
index 7f4a0a6..adc859d 100644
--- a/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb
+++ b/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb
@@ -8,6 +8,7 @@ describe Jobs::DiscoursePostEventSendReminder do
 
   let(:admin_1) { Fabricate(:user, admin: true) }
   let(:going_user) { Fabricate(:user) }
+  let(:interested_user) { Fabricate(:user) }
   let(:visited_going_user) { Fabricate(:user) }
   let(:not_going_user) { Fabricate(:user) }
   let(:going_user_unread_notification) { Fabricate(:user) }
@@ -17,6 +18,7 @@ describe Jobs::DiscoursePostEventSendReminder do
 
   def init_invitees
     Invitee.create_attendance!(going_user.id, event_1.id, :going)
+    Invitee.create_attendance!(interested_user.id, event_1.id, :interested)
     Invitee.create_attendance!(not_going_user.id, event_1.id, :not_going)
     Invitee.create_attendance!(going_user_unread_notification.id, event_1.id, :going)
     Invitee.create_attendance!(going_user_read_notification.id, event_1.id, :going)
@@ -24,6 +26,7 @@ describe Jobs::DiscoursePostEventSendReminder do
 
     [
       going_user,
+      interested_user,
       not_going_user,
       going_user_unread_notification,
       going_user_read_notification,
@@ -113,6 +116,14 @@ describe Jobs::DiscoursePostEventSendReminder do
           }.to change { going_user.reload.unread_notifications }.by(1)
         end
 
+        it 'creates a new notification for interested user' do
+          expect(interested_user.reload.unread_notifications).to eq(0)
+
+          expect {
+            subject.execute(event_id: event_1.id, reminder: reminders)
+          }.to change { interested_user.reload.unread_notifications }.by(1)
+        end
+
         it 'doesn’t create a new notification for not going user' do
           expect(not_going_user.unread_notifications).to eq(0)
 

GitHub sha: 7c64c6a2

1 Like