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>
|
||||
{{/if}}
|
||||
|
||||
{{selectedPostsCount}}
|
||||
<p>{{{i18n topic.merge_topic.instructions count="selectedPostsCount"}}}</p>
|
||||
|
||||
{{chooseTopic selectedTopicId=selectedTopicId}}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
class PostMover
|
||||
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)
|
||||
@original_topic = original_topic
|
||||
@user = user
|
||||
|
@ -8,12 +12,16 @@ class PostMover
|
|||
end
|
||||
|
||||
def to_topic(id)
|
||||
@move_type = PostMover.move_types[:existing_topic]
|
||||
|
||||
Topic.transaction do
|
||||
move_posts_to Topic.find_by_id(id)
|
||||
end
|
||||
end
|
||||
|
||||
def to_new_topic(title)
|
||||
@move_type = PostMover.move_types[:new_topic]
|
||||
|
||||
Topic.transaction do
|
||||
move_posts_to Topic.create!(
|
||||
user: user,
|
||||
|
@ -94,11 +102,9 @@ class PostMover
|
|||
def create_moderator_post_in_original_topic
|
||||
original_topic.add_moderator_post(
|
||||
user,
|
||||
I18n.t(
|
||||
"move_posts.moderator_post",
|
||||
I18n.t("move_posts.#{PostMover.move_types[@move_type].to_s}_moderator_post",
|
||||
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
|
||||
)
|
||||
end
|
||||
|
|
|
@ -661,9 +661,12 @@ en:
|
|||
frequent_poster: "Frequent Poster"
|
||||
|
||||
move_posts:
|
||||
moderator_post:
|
||||
new_topic_moderator_post:
|
||||
one: "I moved a post 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:
|
||||
archived_enabled: "This topic is now archived. It is frozen and cannot be changed in any way."
|
||||
|
|
Loading…
Reference in New Issue