FEATURE: Promote bookmarks with reminders to core functionality (#9369)

The main thrust of this PR is to take all the conditional checks based on the `enable_bookmarks_with_reminders` away and only keep the code from the `true` path, making bookmarks with reminders the core bookmarks feature. There is also a migration to create `Bookmark` records out of `PostAction` bookmarks for a site.

### Summary

* Remove logic based on whether enable_bookmarks_with_reminders is true. This site setting is now obsolete, the old bookmark functionality is being removed. Retain the setting and set the value to `true` in a migration.
* Use the code from the rake task to create a database migration that creates bookmarks from post actions.
* Change the bookmark report to read from the new table.
* Get rid of old endpoints for bookmarks
* Link to the new bookmarks list from the user summary page
This commit is contained in:
Martin Brennan
2020-04-22 13:44:19 +10:00
committed by GitHub
parent 5a98869c5d
commit 628ba9d1e2
41 changed files with 254 additions and 469 deletions

View File

@ -247,26 +247,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
end
end
it 'should create the right reply' do
post.update!(user: discobot_user)
narrative.expects(:enqueue_timeout_job).with(user)
narrative.input(:bookmark, user, post: post)
new_post = Post.last
profile_page_url = "#{Discourse.base_url}/u/#{user.username}"
expected_raw = <<~RAW
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.reply', bookmark_url: "#{profile_page_url}/activity/bookmarks", base_uri: '')}
#{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.instructions', base_uri: '')}
RAW
expect(new_post.raw).to eq(expected_raw.chomp)
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_onebox)
end
it 'should create the right reply when bookmarks with reminders are enabled' do
SiteSetting.enable_bookmarks_with_reminders = true
post.update!(user: discobot_user)
narrative.expects(:enqueue_timeout_job).with(user)