UX: Stop putting usernames in edit reason when changing post owner

This commit is contained in:
Gerhard Schlager 2018-08-20 12:26:19 +02:00
parent b4f92a05b3
commit 14af90df5b
3 changed files with 3 additions and 14 deletions

View File

@ -546,13 +546,7 @@ class Post < ActiveRecord::Base
def set_owner(new_user, actor, skip_revision = false)
return if user_id == new_user.id
edit_reason = I18n.with_locale(SiteSetting.default_locale) do
I18n.t(
'change_owner.post_revision_text',
old_user: self.user&.username_lower || I18n.t('change_owner.deleted_user'),
new_user: new_user.username_lower
)
end
edit_reason = I18n.t('change_owner.post_revision_text', locale: SiteSetting.default_locale)
revise(
actor,

View File

@ -1868,8 +1868,7 @@ en:
other: "%{count} posts were merged into an existing topic: %{topic_link}"
change_owner:
post_revision_text: "Ownership transferred from %{old_user} to %{new_user}"
deleted_user: "a deleted user"
post_revision_text: "Ownership transferred"
topic_statuses:
archived_enabled: "This topic is now archived. It is frozen and cannot be changed in any way."

View File

@ -1077,16 +1077,12 @@ describe Post do
it "uses default locale for edit reason" do
I18n.locale = 'de'
old_username = post.user.username_lower
post.set_owner(coding_horror, Discourse.system_user)
post.reload
expected_reason = I18n.with_locale(SiteSetting.default_locale) do
I18n.t('change_owner.post_revision_text',
old_user: old_username,
new_user: coding_horror.username_lower
)
I18n.t('change_owner.post_revision_text')
end
expect(post.edit_reason).to eq(expected_reason)