FIX: Rename delete_when_reminder_sent? bookmark method to avoid conflict with AR (#10333)

I added delete_when_reminder_sent to ignored_columns because it no longer exists and added a shortcut method delete_when_reminder_sent? to the Bookmark model. However I have been seeing some weird errors like:

> Job exception: unknown attribute 'delete_when_reminder_sent' for Bookmark.

So I am very suspicious. I am just renaming the method to auto_delete_when_reminder_sent? to avoid any potential conflicts.

Also found include_bookmark_delete_on_owner_reply? in PostSerializer which is used for nothing; I must have forgotten to delete it before.
This commit is contained in:
Martin Brennan 2020-07-29 17:02:36 +10:00 committed by GitHub
parent 04a3b949a4
commit 36c11cb62b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -69,11 +69,11 @@ class Bookmark < ActiveRecord::Base
self.reminder_at.blank? && self.reminder_type.blank? self.reminder_at.blank? && self.reminder_type.blank?
end end
def delete_when_reminder_sent? def auto_delete_when_reminder_sent?
self.auto_delete_preference == Bookmark.auto_delete_preferences[:when_reminder_sent] self.auto_delete_preference == Bookmark.auto_delete_preferences[:when_reminder_sent]
end end
def delete_on_owner_reply? def auto_delete_on_owner_reply?
self.auto_delete_preference == Bookmark.auto_delete_preferences[:on_owner_reply] self.auto_delete_preference == Bookmark.auto_delete_preferences[:on_owner_reply]
end end

View File

@ -354,10 +354,6 @@ class PostSerializer < BasicPostSerializer
bookmarked bookmarked
end end
def include_bookmark_delete_on_owner_reply?
bookmarked
end
def include_bookmark_id? def include_bookmark_id?
bookmarked bookmarked
end end

View File

@ -10,7 +10,7 @@ class BookmarkReminderNotificationHandler
create_notification(bookmark) create_notification(bookmark)
if bookmark.delete_when_reminder_sent? if bookmark.auto_delete_when_reminder_sent?
BookmarkManager.new(bookmark.user).destroy(bookmark.id) BookmarkManager.new(bookmark.user).destroy(bookmark.id)
end end