FIX: When moving topics to an existing topic, say it's an existing topic in the moderator message.
This commit is contained in:
parent
9c552c39a2
commit
22e6b3f466
|
@ -5,7 +5,6 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{selectedPostsCount}}
|
|
||||||
<p>{{{i18n topic.merge_topic.instructions count="selectedPostsCount"}}}</p>
|
<p>{{{i18n topic.merge_topic.instructions count="selectedPostsCount"}}}</p>
|
||||||
|
|
||||||
{{chooseTopic selectedTopicId=selectedTopicId}}
|
{{chooseTopic selectedTopicId=selectedTopicId}}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
class PostMover
|
class PostMover
|
||||||
attr_reader :original_topic, :destination_topic, :user, :post_ids
|
attr_reader :original_topic, :destination_topic, :user, :post_ids
|
||||||
|
|
||||||
|
def self.move_types
|
||||||
|
@move_types ||= Enum.new(:new_topic, :existing_topic)
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(original_topic, user, post_ids)
|
def initialize(original_topic, user, post_ids)
|
||||||
@original_topic = original_topic
|
@original_topic = original_topic
|
||||||
@user = user
|
@user = user
|
||||||
|
@ -8,12 +12,16 @@ class PostMover
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_topic(id)
|
def to_topic(id)
|
||||||
|
@move_type = PostMover.move_types[:existing_topic]
|
||||||
|
|
||||||
Topic.transaction do
|
Topic.transaction do
|
||||||
move_posts_to Topic.find_by_id(id)
|
move_posts_to Topic.find_by_id(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_new_topic(title)
|
def to_new_topic(title)
|
||||||
|
@move_type = PostMover.move_types[:new_topic]
|
||||||
|
|
||||||
Topic.transaction do
|
Topic.transaction do
|
||||||
move_posts_to Topic.create!(
|
move_posts_to Topic.create!(
|
||||||
user: user,
|
user: user,
|
||||||
|
@ -94,11 +102,9 @@ class PostMover
|
||||||
def create_moderator_post_in_original_topic
|
def create_moderator_post_in_original_topic
|
||||||
original_topic.add_moderator_post(
|
original_topic.add_moderator_post(
|
||||||
user,
|
user,
|
||||||
I18n.t(
|
I18n.t("move_posts.#{PostMover.move_types[@move_type].to_s}_moderator_post",
|
||||||
"move_posts.moderator_post",
|
count: post_ids.count,
|
||||||
count: post_ids.count,
|
topic_link: "[#{destination_topic.title}](#{destination_topic.url})"),
|
||||||
topic_link: "[#{destination_topic.title}](#{destination_topic.url})"
|
|
||||||
),
|
|
||||||
post_number: @first_post_number_moved
|
post_number: @first_post_number_moved
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -661,9 +661,12 @@ en:
|
||||||
frequent_poster: "Frequent Poster"
|
frequent_poster: "Frequent Poster"
|
||||||
|
|
||||||
move_posts:
|
move_posts:
|
||||||
moderator_post:
|
new_topic_moderator_post:
|
||||||
one: "I moved a post to a new topic: %{topic_link}"
|
one: "I moved a post to a new topic: %{topic_link}"
|
||||||
other: "I moved %{count} posts to a new topic: %{topic_link}"
|
other: "I moved %{count} posts to a new topic: %{topic_link}"
|
||||||
|
existing_topic_moderator_post:
|
||||||
|
one: "I moved a post to an existing topic: %{topic_link}"
|
||||||
|
other: "I moved %{count} posts to an existing topic: %{topic_link}"
|
||||||
|
|
||||||
topic_statuses:
|
topic_statuses:
|
||||||
archived_enabled: "This topic is now archived. It is frozen and cannot be changed in any way."
|
archived_enabled: "This topic is now archived. It is frozen and cannot be changed in any way."
|
||||||
|
|
Loading…
Reference in New Issue