FEATURE: Allow custom date + time for bookmark reminders (#9185)

A custom date and time can now be selected for a bookmark reminder

The reminder will not happen at the exact time but rather at the next 5 minute interval of the bookmark reminder schedule.

This PR also fixes issues with bulk deleting topic bookmarks.
This commit is contained in:
Martin Brennan
2020-03-12 10:52:15 +10:00
committed by GitHub
parent 793f39139a
commit 849631188f
7 changed files with 88 additions and 16 deletions

View File

@ -512,9 +512,13 @@ class PostsController < ApplicationController
params.require(:post_id)
existing_bookmark = Bookmark.find_by(post_id: params[:post_id], user_id: current_user.id)
existing_bookmark.destroy if existing_bookmark.present?
topic_bookmarked = false
if existing_bookmark.present?
topic_bookmarked = Bookmark.exists?(topic_id: existing_bookmark.topic_id, user_id: current_user.id)
existing_bookmark.destroy
end
topic_bookmarked = Bookmark.exists?(topic_id: existing_bookmark.topic_id, user_id: current_user.id)
render json: success_json.merge(topic_bookmarked: topic_bookmarked)
end