Skip to content

A platform for community discussion. Free, open, simple.

FIX: all staff_counters should be pluralized strings (#21048)

David Battersby7d34ba38a212
diff --git a/app/assets/javascripts/discourse/app/templates/user.hbs b/app/assets/javascripts/discourse/app/templates/user.hbs
index 6b73db4c03f..056929c85f5 100644
--- a/app/assets/javascripts/discourse/app/templates/user.hbs
+++ b/app/assets/javascripts/discourse/app/templates/user.hbs
@@ -42,10 +42,12 @@
type="ReviewableFlaggedPost"
}}
>
- <span
- class="flagged-posts"
- >{{this.model.number_of_flagged_posts}}</span>{{i18n
- "user.staff_counters.flagged_posts"
+ {{html-safe
+ (i18n
+ "user.staff_counters.flagged_posts"
+ className="flagged-posts"
+ count=this.model.number_of_flagged_posts
+ )
}}
</LinkTo>
</div>
@@ -60,10 +62,12 @@
type="ReviewableQueuedPost"
}}
>
- <span
- class="flagged-posts"
- >{{this.model.number_of_rejected_posts}}</span>{{i18n
- "user.staff_counters.rejected_posts"
+ {{html-safe
+ (i18n
+ "user.staff_counters.rejected_posts"
+ className="flagged-posts"
+ count=this.model.number_of_rejected_posts
+ )
}}
</LinkTo>
</div>
@@ -72,10 +76,12 @@
{{#if this.model.number_of_deleted_posts}}
<div>
<LinkTo @route="user.deletedPosts" @model={{this.model}}>
- <span
- class="deleted-posts"
- >{{this.model.number_of_deleted_posts}}</span>{{i18n
- "user.staff_counters.deleted_posts"
+ {{html-safe
+ (i18n
+ "user.staff_counters.deleted_posts"
+ className="deleted-posts"
+ count=this.model.number_of_deleted_posts
+ )
}}
</LinkTo>
</div>
@@ -83,10 +89,12 @@
{{#if this.model.number_of_suspensions}}
<div>
<a href {{on "click" this.showSuspensions}}>
- <span
- class="suspensions"
- >{{this.model.number_of_suspensions}}</span>{{i18n
- "user.staff_counters.suspensions"
+ {{html-safe
+ (i18n
+ "user.staff_counters.suspensions"
+ className="suspensions"
+ count=this.model.number_of_suspensions
+ )
}}
</a>
</div>
@@ -97,10 +105,13 @@
@route="userPrivateMessages.user.warnings"
@model={{this.model}}
>
- <span
- class="warnings-received"
- >{{this.model.warnings_received_count}}</span>
- {{i18n "user.staff_counters.warnings_received"}}
+ {{html-safe
+ (i18n
+ "user.staff_counters.warnings_received"
+ className="warnings-received"
+ count=this.model.warnings_received_count
+ )
+ }}
</LinkTo>
</div>
{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 3ba455d5e44..d2c7bed7ba0 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1284,11 +1284,21 @@ en:
flags_given:
one: '<span class="%{className}">%{count}</span> helpful flag'
other: '<span class="%{className}">%{count}</span> helpful flags'
- flagged_posts: "flagged posts"
- deleted_posts: "deleted posts"
- suspensions: "suspensions"
- warnings_received: "warnings"
- rejected_posts: "rejected posts"
+ flagged_posts:
+ one: '<span class="%{className}">%{count}</span> flagged post'
+ other: '<span class="%{className}">%{count}</span> flagged posts'
+ deleted_posts:
+ one: '<span class="%{className}">%{count}</span> deleted post'
+ other: '<span class="%{className}">%{count}</span> deleted posts'
+ suspensions:
+ one: '<span class="%{className}">%{count}</span> suspension'
+ other: '<span class="%{className}">%{count}</span> suspensions'
+ warnings_received:
+ one: '<span class="%{className}">%{count}</span> warning'
+ other: '<span class="%{className}">%{count}</span> warnings'
+ rejected_posts:
+ one: '<span class="%{className}">%{count}</span> rejected post'
+ other: '<span class="%{className}">%{count}</span> rejected posts'
messages:
all: "all inboxes"
diff --git a/spec/system/page_objects/pages/user.rb b/spec/system/page_objects/pages/user.rb
index ab9d7c18aa1..a596f82db83 100644
--- a/spec/system/page_objects/pages/user.rb
+++ b/spec/system/page_objects/pages/user.rb
@@ -24,11 +24,9 @@ module PageObjects
page.has_current_path?("/u/#{user.username}/messages/warnings")
end
- def click_staff_info_warnings_link(warnings_count: 0)
+ def click_staff_info_warnings_link(user, warnings_count: 0)
staff_counters = page.find(".staff-counters")
- staff_counters.click_link(
- "#{warnings_count} #{I18n.t("js.user.staff_counters.warnings_received")}",
- )
+ staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click
self
end
end
diff --git a/spec/system/user_page/staff_info_spec.rb b/spec/system/user_page/staff_info_spec.rb
index 1ffa8ac8273..0171b17746e 100644
--- a/spec/system/user_page/staff_info_spec.rb
+++ b/spec/system/user_page/staff_info_spec.rb
@@ -12,7 +12,7 @@ describe "Viewing user staff info as an admin", type: :system, js: true do
fab!(:user_warning) { UserWarning.create!(user: user, created_by: admin, topic: topic) }
it "should display the right link to user's warnings with the right count in text" do
- user_page.visit(user).click_staff_info_warnings_link(warnings_count: 1)
+ user_page.visit(user).click_staff_info_warnings_link(user, warnings_count: 1)
expect(user_page).to have_warning_messages_path(user)
end