FIX: Remove user_option saving for bookmark auto delete pref (#19476)

We were changing the user's user_option.bookmark_auto_delete_preference
to whatever they changed it to in the bookmark modal to use as default
for future bookmarks. However this was leading to a lot of confusion
since if you wanted to set it for one bookmark you had to remember to
change it back on the next one.

This commit removes that automatic functionality, and instead moves
the bookmark auto delete preference to User Preferences > Interface
in an explicit dropdown.
This commit is contained in:
Martin Brennan
2022-12-16 08:50:31 +10:00
committed by GitHub
parent b1e08364ef
commit 624b1b3820
12 changed files with 62 additions and 91 deletions

View File

@ -57,7 +57,6 @@ class BookmarkManager
return add_errors_from(bookmark) if bookmark.errors.any?
registered_bookmarkable.after_create(@guardian, bookmark, options)
update_user_option(bookmark, options)
bookmark
end
@ -109,8 +108,6 @@ class BookmarkManager
return add_errors_from(bookmark)
end
update_user_option(bookmark, options)
success
end
@ -142,15 +139,6 @@ class BookmarkManager
TopicUser.change(@user.id, topic, bookmarked: Bookmark.for_user_in_topic(@user.id, topic.id).exists?)
end
def update_user_option(bookmark, options)
return if !options[:save_user_preferences]
return if options[:auto_delete_preference].blank?
@user.user_option.update!(
bookmark_auto_delete_preference: bookmark.auto_delete_preference
)
end
def bookmark_model_options_with_defaults(options)
model_options = {
pinned: options[:pinned]