Skip to content

Commit

Permalink
UX: Stop putting usernames in edit reason when changing post owner
Browse files Browse the repository at this point in the history
  • Loading branch information
gschlager committed Aug 20, 2018
1 parent b4f92a0 commit 14af90d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
8 changes: 1 addition & 7 deletions app/models/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,7 @@ def rebake!(opts = nil)
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,
Expand Down
3 changes: 1 addition & 2 deletions config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
6 changes: 1 addition & 5 deletions spec/models/post_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1077,16 +1077,12 @@ def post_with_body(body, user = nil)

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)
Expand Down

1 comment on commit 14af90d

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.