FIX: Narrative bot not working for bookmarks with reminders (#9289)

Reported https://meta.discourse.org/t/improved-bookmarks-with-reminders/144542/42?u=mjrbrennan

* There was no callback on the bookmark model to trigger the next step of the narrative bot on bookmark.
* Also the translation URL path was hardcoded, needs to be conditional based on whether the site setting is enabled.
This commit is contained in:
Martin Brennan
2020-03-27 12:17:18 +10:00
committed by GitHub
parent 40b6e278a0
commit 0cb40fe9ed
4 changed files with 36 additions and 3 deletions
@@ -233,8 +233,14 @@ module DiscourseNarrativeBot
return unless valid_topic?(@post.topic_id)
return unless @post.user_id == self.discobot_user.id
profile_page_url = url_helpers(:user_url, username: @user.username)
bookmark_url = if SiteSetting.enable_bookmarks_with_reminders?
"#{profile_page_url}/activity/bookmarks-with-reminders"
else
"#{profile_page_url}/activity/bookmarks"
end
raw = <<~RAW
#{I18n.t("#{I18N_KEY}.bookmark.reply", i18n_post_args(profile_page_url: url_helpers(:user_url, username: @user.username)))}
#{I18n.t("#{I18N_KEY}.bookmark.reply", i18n_post_args(bookmark_url: bookmark_url))}
#{instance_eval(&@next_instructions)}
RAW