FIX: Minor bookmark with reminder issue cleanup (#9436)

* Count user summary bookmarks from new Bookmark table if bookmarks with reminders enabled
* Update topic user bookmarked column when new topic bookmark changed
* Make in:bookmarks search work with new bookmarks
* Fix batch inserts for bookmark rake task (and thus migration). We were only inserting one bookmark at a time, completely defeating the purpose of batching!
This commit is contained in:
Martin Brennan
2020-04-16 11:32:21 +10:00
committed by GitHub
parent d7f744490a
commit 51672b9121
5 changed files with 85 additions and 36 deletions

View File

@@ -32,6 +32,14 @@ RSpec.describe BookmarkManager do
end
end
context "when bookmarking the topic level (post is OP)" do
it "updates the topic user bookmarked column to true" do
subject.create(post_id: post.id, name: name, reminder_type: reminder_type, reminder_at: reminder_at)
tu = TopicUser.find_by(user: user)
expect(tu.bookmarked).to eq(true)
end
end
context "when the reminder type is at_desktop" do
let(:reminder_type) { 'at_desktop' }
let(:reminder_at) { nil }
@@ -188,6 +196,12 @@ RSpec.describe BookmarkManager do
end
end
it "updates the topic user bookmarked column to false" do
TopicUser.create(user: user, topic: topic, bookmarked: true)
subject.destroy_for_topic(topic)
tu = TopicUser.find_by(user: user)
expect(tu.bookmarked).to eq(false)
end
end
describe ".send_reminder_notification" do