FIX: Simplify post and topic deletion language (#13128)

Based on feedback from Matt Haughey, we don't need to use so many words when describing a deleted topic or post.

Co-authored-by: Martin Brennan <martin@discourse.org>
This commit is contained in:
Jeff Atwood 2021-05-24 19:04:10 -07:00 committed by GitHub
parent fccf4d4375
commit 50926f6143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 19 deletions

View File

@ -208,13 +208,9 @@ const Post = RestModel.extend({
} else { } else {
const key = const key =
this.post_number === 1 this.post_number === 1
? "topic.deleted_by_author" ? "topic.deleted_by_author_simple"
: "post.deleted_by_author"; : "post.deleted_by_author_simple";
promise = cookAsync( promise = cookAsync(I18n.t(key)).then((cooked) => {
I18n.t(key, {
count: this.siteSettings.delete_removed_posts_after,
})
).then((cooked) => {
this.setProperties({ this.setProperties({
cooked: cooked, cooked: cooked,
can_delete: false, can_delete: false,

View File

@ -2877,10 +2877,7 @@ en:
description: description:
one: You have selected <b>%{count}</b> post. one: You have selected <b>%{count}</b> post.
other: "You have selected <b>%{count}</b> posts." other: "You have selected <b>%{count}</b> posts."
deleted_by_author_simple: "(topic deleted by author)"
deleted_by_author:
one: "(topic withdrawn by author, will be automatically deleted in %{count} hour unless flagged)"
other: "(topic withdrawn by author, will be automatically deleted in %{count} hours unless flagged)"
post: post:
quote_reply: "Quote" quote_reply: "Quote"
@ -2896,9 +2893,7 @@ en:
follow_quote: "go to the quoted post" follow_quote: "go to the quoted post"
show_full: "Show Full Post" show_full: "Show Full Post"
show_hidden: "View ignored content." show_hidden: "View ignored content."
deleted_by_author: deleted_by_author_simple: "(post deleted by author)"
one: "(post withdrawn by author, will be automatically deleted in %{count} hour unless flagged)"
other: "(post withdrawn by author, will be automatically deleted in %{count} hours unless flagged)"
collapse: "collapse" collapse: "collapse"
expand_collapse: "expand/collapse" expand_collapse: "expand/collapse"
locked: "a staff member has locked this post from being edited" locked: "a staff member has locked this post from being edited"

View File

@ -196,9 +196,9 @@ class PostDestroyer
I18n.with_locale(SiteSetting.default_locale) do I18n.with_locale(SiteSetting.default_locale) do
# don't call revise from within transaction, high risk of deadlock # don't call revise from within transaction, high risk of deadlock
key = @post.is_first_post? ? 'js.topic.deleted_by_author' : 'js.post.deleted_by_author' key = @post.is_first_post? ? 'js.topic.deleted_by_author_simple' : 'js.post.deleted_by_author_simple'
@post.revise(@user, @post.revise(@user,
{ raw: I18n.t(key, count: delete_removed_posts_after) }, { raw: I18n.t(key) },
force_new_version: true, force_new_version: true,
deleting_post: true deleting_post: true
) )

View File

@ -330,7 +330,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
post = Post.last post = Post.last
expect(post.raw).to eq(I18n.t('js.post.deleted_by_author', count: 1)) expect(post.raw).to eq(I18n.t('js.post.deleted_by_author_simple'))
PostDestroyer.destroy_stubs PostDestroyer.destroy_stubs

View File

@ -381,7 +381,7 @@ describe PostDestroyer do
expect(post2.deleted_at).to be_blank expect(post2.deleted_at).to be_blank
expect(post2.deleted_by).to be_blank expect(post2.deleted_by).to be_blank
expect(post2.user_deleted).to eq(true) expect(post2.user_deleted).to eq(true)
expect(post2.raw).to eq(I18n.t('js.topic.deleted_by_author', count: 24)) expect(post2.raw).to eq(I18n.t('js.topic.deleted_by_author_simple'))
expect(post2.version).to eq(2) expect(post2.version).to eq(2)
expect(called).to eq(1) expect(called).to eq(1)
expect(user_stat.reload.post_count).to eq(0) expect(user_stat.reload.post_count).to eq(0)
@ -462,7 +462,7 @@ describe PostDestroyer do
expect(post.deleted_at).to eq(nil) expect(post.deleted_at).to eq(nil)
expect(post.user_deleted).to eq(true) expect(post.user_deleted).to eq(true)
expect(post.raw).to eq(I18n.t('js.post.deleted_by_author', count: 1)) expect(post.raw).to eq(I18n.t('js.post.deleted_by_author_simple'))
end end
context "as a moderator" do context "as a moderator" do