mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 04:53:58 +08:00
FIX: narrative bot on subfolder installs
This commit is contained in:
parent
d46f98a8d5
commit
3582aa68bf
|
@ -168,7 +168,7 @@ en:
|
|||
- https://en.wikipedia.org/wiki/Death_by_coconut
|
||||
- https://en.wikipedia.org/wiki/Calculator_spelling
|
||||
reply: |-
|
||||
Cool! This will work for most <img src="/images/font-awesome-link.png" width="16" height="16"> links. Remember, it must be on a line _all by itself_, with nothing else in front, or behind.
|
||||
Cool! This will work for most <img src="%{base_uri}/images/font-awesome-link.png" width="16" height="16"> links. Remember, it must be on a line _all by itself_, with nothing else in front, or behind.
|
||||
not_found: |-
|
||||
Sorry, I couldn’t find the link in your reply! :cry:
|
||||
|
||||
|
@ -180,7 +180,7 @@ en:
|
|||
instructions: |-
|
||||
Here’s a picture of a unicorn:
|
||||
|
||||
<img src="/images/unicorn.png" width="520" height="520">
|
||||
<img src="%{base_uri}/images/unicorn.png" width="520" height="520">
|
||||
|
||||
If you like it (and who wouldn’t!) go ahead and press the like :heart: button below this post to let me know.
|
||||
|
||||
|
@ -233,11 +233,11 @@ en:
|
|||
|
||||
bookmark:
|
||||
instructions: |-
|
||||
If you’d like to learn more, select <img src="/images/font-awesome-ellipsis.png" width="16" height="16"> below and <img src="/images/font-awesome-bookmark.png" width="16" height="16"> **bookmark this private message**. If you do, there may be a :gift: in your future!
|
||||
If you’d like to learn more, select <img src="%{base_uri}/images/font-awesome-ellipsis.png" width="16" height="16"> below and <img src="%{base_uri}/images/font-awesome-bookmark.png" width="16" height="16"> **bookmark this private message**. If you do, there may be a :gift: in your future!
|
||||
reply: |-
|
||||
Excellent! Now you can easily find your way back to our private conversation any time, right from [the bookmarks tab on your profile](%{profile_page_url}/activity/bookmarks). Just select your profile picture at the upper right ↗
|
||||
not_found: |-
|
||||
Uh oh, I don’t see any bookmarks in this topic. Did you find the bookmark under each post? Use the show more <img src="/images/font-awesome-ellipsis.png" width="16" height="16"> to reveal additional actions if needed.
|
||||
Uh oh, I don’t see any bookmarks in this topic. Did you find the bookmark under each post? Use the show more <img src="%{base_uri}/images/font-awesome-ellipsis.png" width="16" height="16"> to reveal additional actions if needed.
|
||||
|
||||
emoji:
|
||||
instructions: |-
|
||||
|
@ -247,7 +247,7 @@ en:
|
|||
|
||||
- Type colon <kbd>:</kbd> then complete the emoji name `:tada:`
|
||||
|
||||
- Press the emoji button <img src="/images/font-awesome-smile.png" width="16" height="16"> in the editor, or on your mobile keyboard
|
||||
- Press the emoji button <img src="%{base_uri}/images/font-awesome-smile.png" width="16" height="16"> in the editor, or on your mobile keyboard
|
||||
reply: |-
|
||||
That’s :sparkles: _emojitastic!_ :sparkles:
|
||||
not_found: |-
|
||||
|
@ -255,7 +255,7 @@ en:
|
|||
|
||||
Try typing a colon <kbd>:</kbd> to bring up the emoji picker, then type the first few letters of what you want, such as `:bird:`
|
||||
|
||||
Or, press the emoji button <img src="/images/font-awesome-smile.png" width="16" height="16"> in the editor.
|
||||
Or, press the emoji button <img src="%{base_uri}/images/font-awesome-smile.png" width="16" height="16"> in the editor.
|
||||
|
||||
(If you are on a mobile device, you can also enter Emoji directly from your keyboard, too.)
|
||||
|
||||
|
@ -277,21 +277,21 @@ en:
|
|||
|
||||
> :imp: I wrote something nasty here
|
||||
|
||||
I guess you know what to do. Go ahead and **flag this post** <img src="/images/font-awesome-flag.png" width="16" height="16"> as inappropriate!
|
||||
I guess you know what to do. Go ahead and **flag this post** <img src="%{base_uri}/images/font-awesome-flag.png" width="16" height="16"> as inappropriate!
|
||||
reply: |-
|
||||
[Our staff](/groups/staff) will be privately notified about your flag. If enough community members flag a post, it will also be automatically hidden as a precaution. (Since I didn’t actually write a nasty post :angel:, I’ve gone ahead and removed the flag for now.)
|
||||
not_found: |-
|
||||
Oh no, my nasty post hasn’t been flagged yet. :worried: Can you flag it as inappropriate using the **flag** <img src="/images/font-awesome-flag.png" width="16" height="16">? Don’t forget to use the show more button <img src="/images/font-awesome-ellipsis.png" width="16" height="16"> to reveal more actions for each post.
|
||||
Oh no, my nasty post hasn’t been flagged yet. :worried: Can you flag it as inappropriate using the **flag** <img src="%{base_uri}/images/font-awesome-flag.png" width="16" height="16">? Don’t forget to use the show more button <img src="%{base_uri}/images/font-awesome-ellipsis.png" width="16" height="16"> to reveal more actions for each post.
|
||||
|
||||
search:
|
||||
instructions: |-
|
||||
_psst_ … I’ve hidden a surprise in this topic. If you’re up for the challenge, **select the search icon** <img src="/images/font-awesome-search.png" width="16" height="16"> at the top right ↗ to search for it.
|
||||
_psst_ … I’ve hidden a surprise in this topic. If you’re up for the challenge, **select the search icon** <img src="%{base_uri}/images/font-awesome-search.png" width="16" height="16"> at the top right ↗ to search for it.
|
||||
|
||||
Try searching for the term "capy​bara" in this topic
|
||||
hidden_message: |-
|
||||
How did you miss this capybara? :wink:
|
||||
|
||||
<img src="/images/capybara-eating.gif"/>
|
||||
<img src="%{base_uri}/images/capybara-eating.gif"/>
|
||||
|
||||
Did you notice you’re now back at the beginning? Feed this poor hungry capybara by **replying with the `:herb:` emoji** and you’ll be automatically taken to the end.
|
||||
reply: |-
|
||||
|
@ -303,7 +303,7 @@ en:
|
|||
|
||||
- If you have a physical :keyboard:, press <kbd>?</kbd> to view our handy keyboard shortcuts.
|
||||
not_found: |-
|
||||
Hmm… looks like you might be having trouble. Sorry about that. Did you search <img src="/images/font-awesome-search.png" width="16" height="16"> for the term **capy​bara**?
|
||||
Hmm… looks like you might be having trouble. Sorry about that. Did you search <img src="%{base_uri}/images/font-awesome-search.png" width="16" height="16"> for the term **capy​bara**?
|
||||
|
||||
end:
|
||||
message: |-
|
||||
|
@ -336,7 +336,7 @@ en:
|
|||
not_found: |-
|
||||
It looks like you’ve yet to edit the [post](%{url}) I created for you. Can you try again?
|
||||
|
||||
Use the <img src="/images/font-awesome-pencil.png" width="16" height="16"> icon to bring up the editor.
|
||||
Use the <img src="%{base_uri}/images/font-awesome-pencil.png" width="16" height="16"> icon to bring up the editor.
|
||||
reply: |-
|
||||
Great work!
|
||||
|
||||
|
@ -346,9 +346,9 @@ en:
|
|||
instructions: |-
|
||||
If you’d like to withdraw a post you made, you can delete it.
|
||||
|
||||
Go ahead and **delete** any of your posts above by using the <img src="/images/font-awesome-trash.png" width="16" height="16"> **delete** action. Don’t delete the first post, though!
|
||||
Go ahead and **delete** any of your posts above by using the <img src="%{base_uri}/images/font-awesome-trash.png" width="16" height="16"> **delete** action. Don’t delete the first post, though!
|
||||
not_found: |-
|
||||
I don’t see any deleted posts yet? Remember <img src="/images/font-awesome-ellipsis.png" width="16" height="16"> show more will reveal <img src="/images/font-awesome-trash.png" width="16" height="16"> delete.
|
||||
I don’t see any deleted posts yet? Remember <img src="%{base_uri}/images/font-awesome-ellipsis.png" width="16" height="16"> show more will reveal <img src="%{base_uri}/images/font-awesome-trash.png" width="16" height="16"> delete.
|
||||
reply: |-
|
||||
Whoa! :boom:
|
||||
|
||||
|
@ -359,9 +359,9 @@ en:
|
|||
instructions: |-
|
||||
Oh no! It looks like I accidentally deleted a new post that I just created for you.
|
||||
|
||||
Can you do me a favor and <img src="/images/font-awesome-rotate-left.png" width="16" height="16"> **undelete** it?
|
||||
Can you do me a favor and <img src="%{base_uri}/images/font-awesome-rotate-left.png" width="16" height="16"> **undelete** it?
|
||||
not_found: |-
|
||||
Having trouble? Remember <img src="/images/font-awesome-ellipsis.png" width="16" height="16"> show more will reveal <img src="/images/font-awesome-rotate-left.png" width="16" height="16"> undelete.
|
||||
Having trouble? Remember <img src="%{base_uri}/images/font-awesome-ellipsis.png" width="16" height="16"> show more will reveal <img src="%{base_uri}/images/font-awesome-rotate-left.png" width="16" height="16"> undelete.
|
||||
reply: |-
|
||||
Phew, that was a close one! Thanks for fixing that :wink:
|
||||
|
||||
|
@ -397,11 +397,11 @@ en:
|
|||
|
||||
poll:
|
||||
instructions: |-
|
||||
Did you know you can add a poll to any post? Try using the <img src="/images/font-awesome-gear.png" width="16" height="16"> gear in the editor to **build a poll**.
|
||||
Did you know you can add a poll to any post? Try using the <img src="%{base_uri}/images/font-awesome-gear.png" width="16" height="16"> gear in the editor to **build a poll**.
|
||||
not_found: |-
|
||||
Whoops! There wasn’t any poll in your reply.
|
||||
|
||||
Use the <img src="/images/font-awesome-gear.png" width="16" height="16"> gear icon in the editor, or copy and paste this poll in your next reply:
|
||||
Use the <img src="%{base_uri}/images/font-awesome-gear.png" width="16" height="16"> gear icon in the editor, or copy and paste this poll in your next reply:
|
||||
|
||||
```text
|
||||
[poll]
|
||||
|
@ -425,12 +425,12 @@ en:
|
|||
- When your post needs lots of optional details that may be overwhelming when read all at once.
|
||||
|
||||
[details=Select this to see how it works!]
|
||||
1. Select the <img src="/images/font-awesome-gear.png" width="16" height="16"> gear in the editor.
|
||||
1. Select the <img src="%{base_uri}/images/font-awesome-gear.png" width="16" height="16"> gear in the editor.
|
||||
2. Select "Hide Details".
|
||||
3. Edit the details summary and add your content.
|
||||
[/details]
|
||||
|
||||
Can you use the <img src="/images/font-awesome-gear.png" width="16" height="16"> gear in the editor to add a details section to your next reply?
|
||||
Can you use the <img src="%{base_uri}/images/font-awesome-gear.png" width="16" height="16"> gear in the editor to add a details section to your next reply?
|
||||
not_found: |-
|
||||
Having trouble creating a details widget? Try including the following in your next reply:
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module DiscourseNarrativeBot
|
|||
TRANSITION_TABLE = {
|
||||
begin: {
|
||||
next_state: :tutorial_edit,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.edit.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.edit.instructions", i18n_post_args) },
|
||||
init: {
|
||||
action: :start_advanced_track
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_edit: {
|
||||
next_state: :tutorial_delete,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.delete.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.delete.instructions", i18n_post_args) },
|
||||
edit: {
|
||||
action: :reply_to_edit
|
||||
},
|
||||
|
@ -26,7 +26,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_delete: {
|
||||
next_state: :tutorial_recover,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.recover.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.recover.instructions", i18n_post_args) },
|
||||
delete: {
|
||||
action: :reply_to_delete
|
||||
},
|
||||
|
@ -47,7 +47,7 @@ module DiscourseNarrativeBot
|
|||
end
|
||||
|
||||
I18n.t("#{I18N_KEY}.category_hashtag.instructions",
|
||||
category: "##{slug}"
|
||||
i18n_post_args(category: "##{slug}")
|
||||
)
|
||||
end,
|
||||
recover: {
|
||||
|
@ -61,7 +61,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_category_hashtag: {
|
||||
next_state: :tutorial_change_topic_notification_level,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.change_topic_notification_level.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.change_topic_notification_level.instructions", i18n_post_args) },
|
||||
reply: {
|
||||
action: :reply_to_category_hashtag
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_change_topic_notification_level: {
|
||||
next_state: :tutorial_poll,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.poll.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.poll.instructions", i18n_post_args) },
|
||||
topic_notification_level_changed: {
|
||||
action: :reply_to_topic_notification_level_changed
|
||||
},
|
||||
|
@ -81,7 +81,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_poll: {
|
||||
next_state: :tutorial_details,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.details.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.details.instructions", i18n_post_args) },
|
||||
reply: {
|
||||
action: :reply_to_poll
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ module DiscourseNarrativeBot
|
|||
post = PostCreator.create!(@user, {
|
||||
raw: I18n.t(
|
||||
"#{I18N_KEY}.edit.bot_created_post_raw",
|
||||
discobot_username: self.discobot_user.username
|
||||
i18n_post_args(discobot_username: self.discobot_user.username)
|
||||
),
|
||||
topic_id: data[:topic_id],
|
||||
skip_bot: true
|
||||
|
@ -135,7 +135,7 @@ module DiscourseNarrativeBot
|
|||
post = PostCreator.create!(@user, {
|
||||
raw: I18n.t(
|
||||
"#{I18N_KEY}.recover.deleted_post_raw",
|
||||
discobot_username: self.discobot_user.username
|
||||
i18n_post_args(discobot_username: self.discobot_user.username)
|
||||
),
|
||||
topic_id: data[:topic_id],
|
||||
skip_bot: true
|
||||
|
@ -146,7 +146,7 @@ module DiscourseNarrativeBot
|
|||
end
|
||||
|
||||
def start_advanced_track
|
||||
raw = I18n.t("#{I18N_KEY}.start_message", username: @user.username)
|
||||
raw = I18n.t("#{I18N_KEY}.start_message", i18n_post_args(username: @user.username))
|
||||
|
||||
raw = <<~RAW
|
||||
#{raw}
|
||||
|
@ -183,7 +183,7 @@ module DiscourseNarrativeBot
|
|||
fake_delay
|
||||
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.edit.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.edit.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -199,7 +199,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.edit.not_found",
|
||||
url: Post.find_by(id: post_id).url
|
||||
i18n_post_args(url: Post.find_by(id: post_id).url)
|
||||
))
|
||||
end
|
||||
|
||||
|
@ -213,7 +213,7 @@ module DiscourseNarrativeBot
|
|||
fake_delay
|
||||
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.delete.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.delete.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -227,7 +227,7 @@ module DiscourseNarrativeBot
|
|||
def missing_delete
|
||||
return unless valid_topic?(@post.topic_id)
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.delete.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.delete.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -238,7 +238,7 @@ module DiscourseNarrativeBot
|
|||
fake_delay
|
||||
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.recover.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.recover.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -254,7 +254,7 @@ module DiscourseNarrativeBot
|
|||
post_id = get_state_data(:post_id) && @post.id != post_id
|
||||
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.recover.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.recover.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -265,7 +265,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if Nokogiri::HTML.fragment(@post.cooked).css('.hashtag').size > 0
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.category_hashtag.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.category_hashtag.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -274,7 +274,7 @@ module DiscourseNarrativeBot
|
|||
reply_to(@post, raw)
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.category_hashtag.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.category_hashtag.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -284,7 +284,7 @@ module DiscourseNarrativeBot
|
|||
return unless valid_topic?(@post.topic_id)
|
||||
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.change_topic_notification_level.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.change_topic_notification_level.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -294,7 +294,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
fake_delay
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.change_topic_notification_level.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.change_topic_notification_level.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -315,7 +315,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if Nokogiri::HTML.fragment(@post.cooked).css(".poll").size > 0
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.poll.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.poll.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -324,7 +324,7 @@ module DiscourseNarrativeBot
|
|||
reply_to(@post, raw)
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.poll.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.poll.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -337,9 +337,9 @@ module DiscourseNarrativeBot
|
|||
fake_delay
|
||||
|
||||
if Nokogiri::HTML.fragment(@post.cooked).css("details").size > 0
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.details.reply"))
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.details.reply", i18n_post_args))
|
||||
else
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.details.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.details.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -352,9 +352,9 @@ module DiscourseNarrativeBot
|
|||
fake_delay
|
||||
|
||||
if @post.wiki
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.wiki.reply"))
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.wiki.reply", i18n_post_args))
|
||||
else
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.wiki.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.wiki.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -364,7 +364,7 @@ module DiscourseNarrativeBot
|
|||
fake_delay
|
||||
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.end.message",
|
||||
certificate: certificate('advanced')
|
||||
i18n_post_args(certificate: certificate('advanced'))
|
||||
))
|
||||
end
|
||||
|
||||
|
|
|
@ -91,9 +91,11 @@ module DiscourseNarrativeBot
|
|||
|
||||
if post = Post.find_by(id: @data[:last_post_id])
|
||||
reply_to(post, I18n.t("discourse_narrative_bot.timeout.message",
|
||||
username: user.username,
|
||||
skip_trigger: TrackSelector.skip_trigger,
|
||||
reset_trigger: "#{TrackSelector.reset_trigger} #{self.class.reset_trigger}",
|
||||
i18n_post_args(
|
||||
username: user.username,
|
||||
skip_trigger: TrackSelector.skip_trigger,
|
||||
reset_trigger: "#{TrackSelector.reset_trigger} #{self.class.reset_trigger}"
|
||||
)
|
||||
))
|
||||
end
|
||||
end
|
||||
|
@ -102,12 +104,11 @@ module DiscourseNarrativeBot
|
|||
options = {
|
||||
user_id: @user.id,
|
||||
date: Time.zone.now.strftime('%b %d %Y'),
|
||||
host: Discourse.base_url,
|
||||
format: :svg
|
||||
}
|
||||
|
||||
options.merge!(type: type) if type
|
||||
src = DiscourseNarrativeBot::Engine.routes.url_helpers.certificate_url(options)
|
||||
src = Discourse.base_url + DiscourseNarrativeBot::Engine.routes.url_helpers.certificate_path(options)
|
||||
"<img class='discobot-certificate' src='#{src}' width='650' height='464' alt='#{I18n.t("#{self.class::I18N_KEY}.certificate.alt")}'>"
|
||||
end
|
||||
|
||||
|
@ -154,6 +155,10 @@ module DiscourseNarrativeBot
|
|||
end
|
||||
end
|
||||
|
||||
def i18n_post_args(extra={})
|
||||
{base_uri: Discourse.base_uri}.merge(extra)
|
||||
end
|
||||
|
||||
def valid_topic?(topic_id)
|
||||
topic_id == @data[:topic_id]
|
||||
end
|
||||
|
|
|
@ -577,7 +577,7 @@ module DiscourseNarrativeBot
|
|||
end
|
||||
|
||||
def avatar_url
|
||||
UrlHelper.absolute(@user.avatar_template.gsub('{size}', '250'))
|
||||
UrlHelper.absolute(Discourse.base_uri + @user.avatar_template.gsub('{size}', '250'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,14 +9,14 @@ module DiscourseNarrativeBot
|
|||
begin: {
|
||||
init: {
|
||||
next_state: :tutorial_bookmark,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.bookmark.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.bookmark.instructions", base_uri: Discourse.base_uri) },
|
||||
action: :say_hello
|
||||
}
|
||||
},
|
||||
|
||||
tutorial_bookmark: {
|
||||
next_state: :tutorial_onebox,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.onebox.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.onebox.instructions", base_uri: Discourse.base_uri) },
|
||||
|
||||
bookmark: {
|
||||
action: :reply_to_bookmark
|
||||
|
@ -30,7 +30,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_onebox: {
|
||||
next_state: :tutorial_emoji,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.emoji.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.emoji.instructions", base_uri: Discourse.base_uri) },
|
||||
|
||||
reply: {
|
||||
action: :reply_to_onebox
|
||||
|
@ -40,7 +40,9 @@ module DiscourseNarrativeBot
|
|||
tutorial_emoji: {
|
||||
next_state: :tutorial_mention,
|
||||
next_instructions: Proc.new {
|
||||
I18n.t("#{I18N_KEY}.mention.instructions", discobot_username: self.discobot_user.username)
|
||||
I18n.t("#{I18N_KEY}.mention.instructions",
|
||||
discobot_username: self.discobot_user.username,
|
||||
base_uri: Discourse.base_uri)
|
||||
},
|
||||
reply: {
|
||||
action: :reply_to_emoji
|
||||
|
@ -49,7 +51,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_mention: {
|
||||
next_state: :tutorial_formatting,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.formatting.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.formatting.instructions", base_uri: Discourse.base_uri) },
|
||||
|
||||
reply: {
|
||||
action: :reply_to_mention
|
||||
|
@ -58,7 +60,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_formatting: {
|
||||
next_state: :tutorial_quote,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.quoting.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.quoting.instructions", base_uri: Discourse.base_uri) },
|
||||
|
||||
reply: {
|
||||
action: :reply_to_formatting
|
||||
|
@ -67,7 +69,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_quote: {
|
||||
next_state: :tutorial_images,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.images.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.images.instructions", base_uri: Discourse.base_uri) },
|
||||
|
||||
reply: {
|
||||
action: :reply_to_quote
|
||||
|
@ -79,7 +81,8 @@ module DiscourseNarrativeBot
|
|||
next_instructions: Proc.new {
|
||||
I18n.t("#{I18N_KEY}.flag.instructions",
|
||||
guidelines_url: url_helpers(:guidelines_url),
|
||||
about_url: url_helpers(:about_index_url))
|
||||
about_url: url_helpers(:about_index_url),
|
||||
base_uri: Discourse.base_uri)
|
||||
},
|
||||
reply: {
|
||||
action: :reply_to_image
|
||||
|
@ -91,7 +94,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
tutorial_flag: {
|
||||
next_state: :tutorial_search,
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.search.instructions") },
|
||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.search.instructions", base_uri: Discourse.base_uri) },
|
||||
flag: {
|
||||
action: :reply_to_flag
|
||||
},
|
||||
|
@ -144,7 +147,7 @@ module DiscourseNarrativeBot
|
|||
raw = <<~RAW
|
||||
#{post.raw}
|
||||
|
||||
#{I18n.t("#{I18N_KEY}.search.hidden_message")}
|
||||
#{I18n.t("#{I18N_KEY}.search.hidden_message", i18n_post_args)}
|
||||
RAW
|
||||
|
||||
PostRevisor.new(post, topic).revise!(
|
||||
|
@ -166,8 +169,10 @@ module DiscourseNarrativeBot
|
|||
def say_hello
|
||||
raw = I18n.t(
|
||||
"#{I18N_KEY}.hello.message",
|
||||
username: @user.username,
|
||||
title: SiteSetting.title
|
||||
i18n_post_args(
|
||||
username: @user.username,
|
||||
title: SiteSetting.title
|
||||
)
|
||||
)
|
||||
|
||||
raw = <<~RAW
|
||||
|
@ -205,7 +210,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
fake_delay
|
||||
enqueue_timeout_job(@user)
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.bookmark.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.bookmark.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
false
|
||||
end
|
||||
|
||||
|
@ -214,7 +219,7 @@ module DiscourseNarrativeBot
|
|||
return unless @post.user_id == self.discobot_user.id
|
||||
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.bookmark.reply", profile_page_url: url_helpers(:user_url, username: @user.username))}
|
||||
#{I18n.t("#{I18N_KEY}.bookmark.reply", i18n_post_args(profile_page_url: url_helpers(:user_url, username: @user.username)))}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -234,7 +239,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if @post.post_analyzer.found_oneboxes?
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.onebox.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.onebox.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -246,7 +251,7 @@ module DiscourseNarrativeBot
|
|||
reply
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.onebox.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.onebox.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -270,7 +275,7 @@ module DiscourseNarrativeBot
|
|||
like_post(post)
|
||||
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.images.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.images.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -304,7 +309,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if get_state_data(:liked)
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.images.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.images.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -313,7 +318,7 @@ module DiscourseNarrativeBot
|
|||
else
|
||||
raw = I18n.t(
|
||||
"#{I18N_KEY}.images.like_not_found",
|
||||
url: Post.find_by(id: @data[:last_post_id]).url
|
||||
i18n_post_args(url: Post.find_by(id: @data[:last_post_id]).url)
|
||||
)
|
||||
|
||||
transition = false
|
||||
|
@ -321,7 +326,7 @@ module DiscourseNarrativeBot
|
|||
else
|
||||
raw = I18n.t(
|
||||
"#{I18N_KEY}.images.not_found",
|
||||
image_url: "#{Discourse.base_url}/images/dog-walk.gif"
|
||||
i18n_post_args(image_url: "#{Discourse.base_url}/images/dog-walk.gif")
|
||||
)
|
||||
|
||||
transition = false
|
||||
|
@ -341,7 +346,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if Nokogiri::HTML.fragment(@post.cooked).css("b", "strong", "em", "i", ".bbcode-i", ".bbcode-b").size > 0
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.formatting.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.formatting.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -353,7 +358,7 @@ module DiscourseNarrativeBot
|
|||
reply
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.formatting.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.formatting.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -367,7 +372,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if doc.css(".quote").size > 0
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.quoting.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.quoting.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -379,7 +384,7 @@ module DiscourseNarrativeBot
|
|||
reply
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.quoting.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.quoting.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -393,7 +398,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if doc.css(".emoji").size > 0
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.emoji.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.emoji.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -405,7 +410,7 @@ module DiscourseNarrativeBot
|
|||
reply
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.emoji.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.emoji.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -417,7 +422,7 @@ module DiscourseNarrativeBot
|
|||
|
||||
if bot_mentioned?(@post)
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.mention.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.mention.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -433,8 +438,10 @@ module DiscourseNarrativeBot
|
|||
unless @data[:attempted]
|
||||
reply_to(@post, I18n.t(
|
||||
"#{I18N_KEY}.mention.not_found",
|
||||
username: @user.username,
|
||||
discobot_username: self.discobot_user.username
|
||||
i18n_post_args(
|
||||
username: @user.username,
|
||||
discobot_username: self.discobot_user.username
|
||||
)
|
||||
))
|
||||
end
|
||||
|
||||
|
@ -448,7 +455,7 @@ module DiscourseNarrativeBot
|
|||
return if @post.user_id == -2
|
||||
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.flag.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.flag.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
false
|
||||
end
|
||||
|
||||
|
@ -458,7 +465,7 @@ module DiscourseNarrativeBot
|
|||
return unless @post.user.id == -2
|
||||
|
||||
raw = <<~RAW
|
||||
#{I18n.t("#{I18N_KEY}.flag.reply")}
|
||||
#{I18n.t("#{I18N_KEY}.flag.reply", i18n_post_args)}
|
||||
|
||||
#{instance_eval(&@next_instructions)}
|
||||
RAW
|
||||
|
@ -478,10 +485,10 @@ module DiscourseNarrativeBot
|
|||
|
||||
if @post.raw.match(/#{SEARCH_ANSWER}/)
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.search.reply", search_url: url_helpers(:search_url)))
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.search.reply", i18n_post_args(search_url: url_helpers(:search_url))))
|
||||
else
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.search.not_found")) unless @data[:attempted]
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.search.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
enqueue_timeout_job(@user)
|
||||
false
|
||||
end
|
||||
|
@ -493,11 +500,13 @@ module DiscourseNarrativeBot
|
|||
reply_to(
|
||||
@post,
|
||||
I18n.t("#{I18N_KEY}.end.message",
|
||||
username: @user.username,
|
||||
base_url: Discourse.base_url,
|
||||
certificate: certificate,
|
||||
discobot_username: self.discobot_user.username,
|
||||
advanced_trigger: AdvancedUserNarrative.reset_trigger
|
||||
i18n_post_args(
|
||||
username: @user.username,
|
||||
base_url: Discourse.base_url,
|
||||
certificate: certificate,
|
||||
discobot_username: self.discobot_user.username,
|
||||
advanced_trigger: AdvancedUserNarrative.reset_trigger
|
||||
)
|
||||
),
|
||||
topic_id: @data[:topic_id]
|
||||
)
|
||||
|
|
|
@ -42,6 +42,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
username: user.username,
|
||||
skip_trigger: skip_trigger,
|
||||
reset_trigger: "#{reset_trigger} #{described_class.reset_trigger}",
|
||||
base_uri: ''
|
||||
))
|
||||
end
|
||||
end
|
||||
|
@ -67,13 +68,13 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
|
||||
expected_raw = I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.start_message',
|
||||
username: user.username
|
||||
username: user.username, base_uri: ''
|
||||
)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{expected_raw}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.edit.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.edit.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
new_post = Post.offset(1).last
|
||||
|
@ -99,13 +100,13 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
|
||||
expected_raw = I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.start_message',
|
||||
username: user.username
|
||||
username: user.username, base_uri: ''
|
||||
)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{expected_raw}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.edit.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.edit.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
new_post = Post.offset(1).last
|
||||
|
@ -159,7 +160,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
|
||||
expect(Post.last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.edit.not_found',
|
||||
url: first_post.url
|
||||
url: first_post.url, base_uri: ''
|
||||
))
|
||||
end
|
||||
|
||||
|
@ -173,7 +174,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.delete.instructions')
|
||||
'discourse_narrative_bot.advanced_user_narrative.delete.instructions', base_uri: '')
|
||||
)
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_delete)
|
||||
|
@ -192,9 +193,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
end.to change { Post.count }.by(1)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.edit.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.edit.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.delete.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.delete.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(Post.last.raw).to eq(expected_raw.chomp)
|
||||
|
@ -220,7 +221,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.delete.not_found'
|
||||
'discourse_narrative_bot.advanced_user_narrative.delete.not_found', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_delete)
|
||||
|
@ -236,7 +237,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.offset(1).last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.recover.instructions')
|
||||
'discourse_narrative_bot.advanced_user_narrative.recover.instructions', base_uri: '')
|
||||
)
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_recover)
|
||||
|
@ -263,9 +264,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
.to change { Post.count }.by(2)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.delete.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.delete.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.recover.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.recover.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_recover)
|
||||
|
@ -281,9 +282,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
.to_not change { Post.count }
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.delete.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.delete.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.recover.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.recover.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_recover)
|
||||
|
@ -314,7 +315,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.recover.not_found'
|
||||
'discourse_narrative_bot.advanced_user_narrative.recover.not_found', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_recover)
|
||||
|
@ -334,7 +335,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.category_hashtag.instructions',
|
||||
category: "#a:b"
|
||||
category: "#a:b", base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_category_hashtag)
|
||||
|
@ -366,9 +367,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
.to change { Post.count }.by(1)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.recover.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.recover.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.category_hashtag.instructions', category: "#a:b")}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.category_hashtag.instructions', category: "#a:b", base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_category_hashtag)
|
||||
|
@ -405,7 +406,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.category_hashtag.not_found'
|
||||
'discourse_narrative_bot.advanced_user_narrative.category_hashtag.not_found', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_category_hashtag)
|
||||
|
@ -421,7 +422,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.instructions'
|
||||
'discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.instructions', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_change_topic_notification_level)
|
||||
|
@ -436,9 +437,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.category_hashtag.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.category_hashtag.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(Post.last.raw).to eq(expected_raw.chomp)
|
||||
|
@ -479,7 +480,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.not_found'
|
||||
'discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.not_found', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_change_topic_notification_level)
|
||||
|
@ -495,7 +496,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.poll.instructions')
|
||||
'discourse_narrative_bot.advanced_user_narrative.poll.instructions', base_uri: '')
|
||||
)
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_poll)
|
||||
|
@ -512,9 +513,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.change_topic_notification_level.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.poll.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.poll.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(Post.last.raw).to eq(expected_raw.chomp)
|
||||
|
@ -547,7 +548,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.advanced_user_narrative.poll.not_found'))
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.advanced_user_narrative.poll.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_poll)
|
||||
end
|
||||
|
||||
|
@ -561,7 +562,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.details.instructions')
|
||||
'discourse_narrative_bot.advanced_user_narrative.details.instructions', base_uri: '')
|
||||
)
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_details)
|
||||
|
@ -574,9 +575,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.poll.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.poll.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.details.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.advanced_user_narrative.details.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(Post.last.raw).to eq(expected_raw.chomp)
|
||||
|
@ -607,7 +608,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
it 'should create the right reply' do
|
||||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.advanced_user_narrative.details.not_found'))
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.advanced_user_narrative.details.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_details)
|
||||
end
|
||||
|
||||
|
@ -631,7 +632,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expect(Post.offset(1).last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.advanced_user_narrative.details.reply'
|
||||
'discourse_narrative_bot.advanced_user_narrative.details.reply', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)).to eq({
|
||||
|
|
|
@ -44,6 +44,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
username: user.username,
|
||||
skip_trigger: skip_trigger,
|
||||
reset_trigger: "#{reset_trigger} #{described_class.reset_trigger}",
|
||||
base_uri: ''
|
||||
))
|
||||
end
|
||||
end
|
||||
|
@ -68,13 +69,13 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.reset_bot(user, post)
|
||||
|
||||
expected_raw = I18n.t('discourse_narrative_bot.new_user_narrative.hello.message',
|
||||
username: user.username, title: SiteSetting.title
|
||||
username: user.username, title: SiteSetting.title, base_uri: ''
|
||||
)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{expected_raw}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.instructions', profile_page_url: profile_page_url)}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.instructions', profile_page_url: profile_page_url, base_uri: '')}
|
||||
RAW
|
||||
|
||||
new_post = Post.last
|
||||
|
@ -96,13 +97,13 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.reset_bot(user, other_post)
|
||||
|
||||
expected_raw = I18n.t('discourse_narrative_bot.new_user_narrative.hello.message',
|
||||
username: user.username, title: SiteSetting.title
|
||||
username: user.username, title: SiteSetting.title, base_uri: ''
|
||||
)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{expected_raw}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.instructions', profile_page_url: profile_page_url)}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.instructions', profile_page_url: profile_page_url, base_uri: '')}
|
||||
RAW
|
||||
|
||||
new_post = Post.last
|
||||
|
@ -159,13 +160,13 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = I18n.t('discourse_narrative_bot.new_user_narrative.hello.message',
|
||||
username: user.username, title: SiteSetting.title
|
||||
username: user.username, title: SiteSetting.title, base_uri: ''
|
||||
)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{expected_raw}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.instructions', profile_page_url: profile_page_url)}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.instructions', profile_page_url: profile_page_url, base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(new_post.raw).to eq(expected_raw.chomp)
|
||||
|
@ -207,7 +208,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.not_found'))
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_bookmark)
|
||||
end
|
||||
|
||||
|
@ -220,9 +221,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.onebox.instructions')
|
||||
)
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.onebox.instructions', base_uri: ''))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_onebox)
|
||||
end
|
||||
|
@ -238,9 +237,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
profile_page_url = "#{Discourse.base_url}/u/#{user.username}"
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.reply', profile_page_url: profile_page_url)}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.reply', profile_page_url: profile_page_url, base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(new_post.raw).to eq(expected_raw.chomp)
|
||||
|
@ -269,7 +268,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.onebox.not_found'))
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.onebox.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_onebox)
|
||||
end
|
||||
end
|
||||
|
@ -280,7 +279,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.onebox.not_found'))
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.onebox.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_onebox)
|
||||
end
|
||||
end
|
||||
|
@ -295,9 +294,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.emoji.instructions')
|
||||
)
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.emoji.instructions', base_uri: ''))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_emoji)
|
||||
end
|
||||
|
@ -312,9 +309,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.emoji.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.emoji.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(new_post.raw).to eq(expected_raw.chomp)
|
||||
|
@ -357,7 +354,8 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.flag.instructions',
|
||||
guidelines_url: Discourse.base_url + '/guidelines',
|
||||
about_url: Discourse.base_url + '/about'
|
||||
about_url: Discourse.base_url + '/about',
|
||||
base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_flag)
|
||||
|
@ -374,7 +372,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
expect(Post.last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.images.not_found',
|
||||
image_url: "#{Discourse.base_url}/images/dog-walk.gif"
|
||||
image_url: "#{Discourse.base_url}/images/dog-walk.gif", base_uri: ''
|
||||
))
|
||||
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
|
@ -388,12 +386,13 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: new_post.id).select
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.images.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.images.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.flag.instructions',
|
||||
guidelines_url: "#{Discourse.base_url}/guidelines",
|
||||
about_url: "#{Discourse.base_url}/about"
|
||||
about_url: "#{Discourse.base_url}/about",
|
||||
base_uri: ''
|
||||
)}
|
||||
RAW
|
||||
|
||||
|
@ -414,7 +413,8 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
expect(Post.last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.images.not_found',
|
||||
image_url: "#{Discourse.base_url}/images/dog-walk.gif"
|
||||
image_url: "#{Discourse.base_url}/images/dog-walk.gif",
|
||||
base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_images)
|
||||
|
@ -430,7 +430,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
expect(Post.last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.images.like_not_found',
|
||||
url: post_2.url
|
||||
url: post_2.url, base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_images)
|
||||
|
@ -447,7 +447,8 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
#{I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.flag.instructions',
|
||||
guidelines_url: "#{Discourse.base_url}/guidelines",
|
||||
about_url: "#{Discourse.base_url}/about"
|
||||
about_url: "#{Discourse.base_url}/about",
|
||||
base_uri: ''
|
||||
)}
|
||||
RAW
|
||||
|
||||
|
@ -482,7 +483,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.expects(:enqueue_timeout_job).with(user)
|
||||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.formatting.not_found'))
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.formatting.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_formatting)
|
||||
end
|
||||
end
|
||||
|
@ -498,7 +499,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.quoting.instructions',
|
||||
'discourse_narrative_bot.new_user_narrative.quoting.instructions', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_quote)
|
||||
|
@ -515,9 +516,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.formatting.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.formatting.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.quoting.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.quoting.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(new_post.raw).to eq(expected_raw.chomp)
|
||||
|
@ -546,7 +547,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.expects(:enqueue_timeout_job).with(user)
|
||||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.quoting.not_found'))
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.quoting.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_quote)
|
||||
end
|
||||
end
|
||||
|
@ -562,11 +563,24 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.images.instructions',
|
||||
'discourse_narrative_bot.new_user_narrative.images.instructions', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_images)
|
||||
end
|
||||
|
||||
it "should use correct path to images on subfolder installs" do
|
||||
GlobalSetting.stubs(:relative_url_root).returns('/forum')
|
||||
Discourse.stubs(:base_uri).returns("/forum")
|
||||
|
||||
post.update!(raw: skip_trigger)
|
||||
|
||||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select
|
||||
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to include("/forum/images")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -580,9 +594,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.quoting.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.quoting.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.images.instructions')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.images.instructions', base_uri: '')}
|
||||
RAW
|
||||
|
||||
expect(new_post.raw).to eq(expected_raw.chomp)
|
||||
|
@ -610,7 +624,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.expects(:enqueue_timeout_job).with(user)
|
||||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.emoji.not_found'))
|
||||
expect(Post.last.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.emoji.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_emoji)
|
||||
end
|
||||
end
|
||||
|
@ -627,7 +641,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.mention.instructions',
|
||||
discobot_username: discobot_user.username
|
||||
discobot_username: discobot_user.username, base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_mention)
|
||||
|
@ -645,10 +659,10 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.emoji.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.emoji.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.mention.instructions',
|
||||
discobot_username: discobot_user.username
|
||||
discobot_username: discobot_user.username, base_uri: ''
|
||||
)}
|
||||
RAW
|
||||
|
||||
|
@ -680,7 +694,8 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
expect(Post.last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.mention.not_found',
|
||||
username: user.username,
|
||||
discobot_username: discobot_user.username
|
||||
discobot_username: discobot_user.username,
|
||||
base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_mention)
|
||||
|
@ -698,7 +713,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.formatting.instructions',
|
||||
discobot_username: discobot_user.username
|
||||
discobot_username: discobot_user.username, base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_formatting)
|
||||
|
@ -715,10 +730,10 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.mention.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.mention.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.formatting.instructions'
|
||||
'discourse_narrative_bot.new_user_narrative.formatting.instructions', base_uri: ''
|
||||
)}
|
||||
RAW
|
||||
|
||||
|
@ -762,7 +777,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.input(:reply, user, post: other_post)
|
||||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.flag.not_found'))
|
||||
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.new_user_narrative.flag.not_found', base_uri: ''))
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_flag)
|
||||
end
|
||||
|
||||
|
@ -776,7 +791,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.search.instructions'
|
||||
'discourse_narrative_bot.new_user_narrative.search.instructions', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_search)
|
||||
|
@ -792,10 +807,10 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
new_post = Post.last
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.flag.reply')}
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.flag.reply', base_uri: '')}
|
||||
|
||||
#{I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.search.instructions'
|
||||
'discourse_narrative_bot.new_user_narrative.search.instructions', base_uri: ''
|
||||
)}
|
||||
RAW
|
||||
|
||||
|
@ -825,7 +840,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
narrative.input(:reply, user, post: post)
|
||||
|
||||
expect(Post.last.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.search.not_found'
|
||||
'discourse_narrative_bot.new_user_narrative.search.not_found', base_uri: ''
|
||||
))
|
||||
|
||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_search)
|
||||
|
@ -847,7 +862,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_search)
|
||||
|
||||
expect(post.reload.topic.first_post.raw).to include(I18n.t(
|
||||
"discourse_narrative_bot.new_user_narrative.search.hidden_message"
|
||||
"discourse_narrative_bot.new_user_narrative.search.hidden_message", base_uri: ''
|
||||
))
|
||||
end
|
||||
|
||||
|
@ -875,7 +890,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
expect(new_post.raw).to eq(I18n.t(
|
||||
'discourse_narrative_bot.new_user_narrative.search.reply',
|
||||
search_url: "#{Discourse.base_url}/search"
|
||||
search_url: "#{Discourse.base_url}/search", base_uri: ''
|
||||
).chomp)
|
||||
|
||||
expect(first_post.reload.raw).to eq('Hello world')
|
||||
|
|
Loading…
Reference in New Issue
Block a user