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

Make all staff_counters pluralized strings
This commit is contained in:
David Battersby
2023-04-12 17:13:37 +08:00
committed by GitHub
parent d86691a767
commit 7d34ba38a2
4 changed files with 49 additions and 30 deletions

View File

@ -42,10 +42,12 @@
type="ReviewableFlaggedPost" type="ReviewableFlaggedPost"
}} }}
> >
<span {{html-safe
class="flagged-posts" (i18n
>{{this.model.number_of_flagged_posts}}</span>{{i18n "user.staff_counters.flagged_posts"
"user.staff_counters.flagged_posts" className="flagged-posts"
count=this.model.number_of_flagged_posts
)
}} }}
</LinkTo> </LinkTo>
</div> </div>
@ -60,10 +62,12 @@
type="ReviewableQueuedPost" type="ReviewableQueuedPost"
}} }}
> >
<span {{html-safe
class="flagged-posts" (i18n
>{{this.model.number_of_rejected_posts}}</span>{{i18n "user.staff_counters.rejected_posts"
"user.staff_counters.rejected_posts" className="flagged-posts"
count=this.model.number_of_rejected_posts
)
}} }}
</LinkTo> </LinkTo>
</div> </div>
@ -72,10 +76,12 @@
{{#if this.model.number_of_deleted_posts}} {{#if this.model.number_of_deleted_posts}}
<div> <div>
<LinkTo @route="user.deletedPosts" @model={{this.model}}> <LinkTo @route="user.deletedPosts" @model={{this.model}}>
<span {{html-safe
class="deleted-posts" (i18n
>{{this.model.number_of_deleted_posts}}</span>{{i18n "user.staff_counters.deleted_posts"
"user.staff_counters.deleted_posts" className="deleted-posts"
count=this.model.number_of_deleted_posts
)
}} }}
</LinkTo> </LinkTo>
</div> </div>
@ -83,10 +89,12 @@
{{#if this.model.number_of_suspensions}} {{#if this.model.number_of_suspensions}}
<div> <div>
<a href {{on "click" this.showSuspensions}}> <a href {{on "click" this.showSuspensions}}>
<span {{html-safe
class="suspensions" (i18n
>{{this.model.number_of_suspensions}}</span>{{i18n "user.staff_counters.suspensions"
"user.staff_counters.suspensions" className="suspensions"
count=this.model.number_of_suspensions
)
}} }}
</a> </a>
</div> </div>
@ -97,10 +105,13 @@
@route="userPrivateMessages.user.warnings" @route="userPrivateMessages.user.warnings"
@model={{this.model}} @model={{this.model}}
> >
<span {{html-safe
class="warnings-received" (i18n
>{{this.model.warnings_received_count}}</span> "user.staff_counters.warnings_received"
{{i18n "user.staff_counters.warnings_received"}} className="warnings-received"
count=this.model.warnings_received_count
)
}}
</LinkTo> </LinkTo>
</div> </div>
{{/if}} {{/if}}

View File

@ -1284,11 +1284,21 @@ en:
flags_given: flags_given:
one: '<span class="%{className}">%{count}</span> helpful flag' one: '<span class="%{className}">%{count}</span> helpful flag'
other: '<span class="%{className}">%{count}</span> helpful flags' other: '<span class="%{className}">%{count}</span> helpful flags'
flagged_posts: "flagged posts" flagged_posts:
deleted_posts: "deleted posts" one: '<span class="%{className}">%{count}</span> flagged post'
suspensions: "suspensions" other: '<span class="%{className}">%{count}</span> flagged posts'
warnings_received: "warnings" deleted_posts:
rejected_posts: "rejected 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: messages:
all: "all inboxes" all: "all inboxes"

View File

@ -24,11 +24,9 @@ module PageObjects
page.has_current_path?("/u/#{user.username}/messages/warnings") page.has_current_path?("/u/#{user.username}/messages/warnings")
end 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 = page.find(".staff-counters")
staff_counters.click_link( staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click
"#{warnings_count} #{I18n.t("js.user.staff_counters.warnings_received")}",
)
self self
end end
end end

View File

@ -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) } 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 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) expect(user_page).to have_warning_messages_path(user)
end end