mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: replace default welcome topic post with new value from wizard
Previously the text entered in the wizard would be prepended onto the default first paragraph.
This commit is contained in:
@ -18,9 +18,12 @@ class IntroductionUpdater
|
||||
|
||||
if previous_value != new_value
|
||||
revisor = PostRevisor.new(post)
|
||||
|
||||
remaining = post.raw.split("\n")[1..-1]
|
||||
revisor.revise!(@user, raw: "#{new_value}\n#{remaining.join("\n")}")
|
||||
if post.raw.chomp == I18n.t('discourse_welcome_topic.body', base_path: Discourse.base_path).chomp
|
||||
revisor.revise!(@user, raw: new_value)
|
||||
else
|
||||
remaining = post.raw[previous_value.length..-1]
|
||||
revisor.revise!(@user, raw: "#{new_value}#{remaining}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user