FIX: Bulk clear reminders when the reminder is expired (#27220)

This commit is contained in:
Jan Cernik 2024-05-28 10:21:33 -03:00 committed by GitHub
parent caa29ec973
commit 76c56c8284
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -65,6 +65,7 @@ export default DropdownSelectBoxComponent.extend({
})
.then(() => {
this.router.refresh();
this.bulkSelectHelper.clear();
this.toasts.success({
duration: 3000,
data: { message: i18n("bookmarks.bulk.reminders_cleared") },
@ -88,6 +89,7 @@ export default DropdownSelectBoxComponent.extend({
})
.then(() => {
this.router.refresh();
this.bulkSelectHelper.clear();
this.toasts.success({
duration: 3000,
data: { message: i18n("bookmarks.bulk.delete_completed") },

View File

@ -120,7 +120,7 @@ class Bookmark < ActiveRecord::Base
end
def clear_reminder!
update!(reminder_last_sent_at: Time.zone.now, reminder_set_at: nil)
update!(reminder_last_sent_at: Time.zone.now, reminder_set_at: nil, reminder_at: nil)
end
def reminder_at_in_zone(timezone)

View File

@ -44,7 +44,9 @@ RSpec.describe BookmarksBulkAction do
expect do
bba = BookmarksBulkAction.new(user, [bookmark_with_reminder.id], type: "clear_reminder")
bba.perform!
end.to change { Bookmark.find_by_id(bookmark_with_reminder.id).reminder_set_at }.to(nil)
end.to change { Bookmark.find_by_id(bookmark_with_reminder.id).reminder_set_at }.to(
nil,
).and change { Bookmark.find_by_id(bookmark_with_reminder.id).reminder_at }.to(nil)
end
end
end