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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 30 deletions

View File

@ -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}}

View File

@ -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"

View File

@ -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

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) }
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