mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
UX: Stop putting usernames in edit reason when changing post owner
This commit is contained in:
@ -546,13 +546,7 @@ class Post < ActiveRecord::Base
|
|||||||
def set_owner(new_user, actor, skip_revision = false)
|
def set_owner(new_user, actor, skip_revision = false)
|
||||||
return if user_id == new_user.id
|
return if user_id == new_user.id
|
||||||
|
|
||||||
edit_reason = I18n.with_locale(SiteSetting.default_locale) do
|
edit_reason = I18n.t('change_owner.post_revision_text', locale: SiteSetting.default_locale)
|
||||||
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
|
|
||||||
|
|
||||||
revise(
|
revise(
|
||||||
actor,
|
actor,
|
||||||
|
@ -1868,8 +1868,7 @@ en:
|
|||||||
other: "%{count} posts were merged into an existing topic: %{topic_link}"
|
other: "%{count} posts were merged into an existing topic: %{topic_link}"
|
||||||
|
|
||||||
change_owner:
|
change_owner:
|
||||||
post_revision_text: "Ownership transferred from %{old_user} to %{new_user}"
|
post_revision_text: "Ownership transferred"
|
||||||
deleted_user: "a deleted user"
|
|
||||||
|
|
||||||
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."
|
||||||
|
@ -1077,16 +1077,12 @@ describe Post do
|
|||||||
|
|
||||||
it "uses default locale for edit reason" do
|
it "uses default locale for edit reason" do
|
||||||
I18n.locale = 'de'
|
I18n.locale = 'de'
|
||||||
old_username = post.user.username_lower
|
|
||||||
|
|
||||||
post.set_owner(coding_horror, Discourse.system_user)
|
post.set_owner(coding_horror, Discourse.system_user)
|
||||||
post.reload
|
post.reload
|
||||||
|
|
||||||
expected_reason = I18n.with_locale(SiteSetting.default_locale) do
|
expected_reason = I18n.with_locale(SiteSetting.default_locale) do
|
||||||
I18n.t('change_owner.post_revision_text',
|
I18n.t('change_owner.post_revision_text')
|
||||||
old_user: old_username,
|
|
||||||
new_user: coding_horror.username_lower
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(post.edit_reason).to eq(expected_reason)
|
expect(post.edit_reason).to eq(expected_reason)
|
||||||
|
Reference in New Issue
Block a user