Skip to content

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

UX: review queue refresh - add missing translation, avoid undefined counts (#36393)

Kris9932b055c638
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index e02b55717c4..021fc41784b 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -972,6 +972,7 @@ en:
flagged_by_users:
one: "Flagged by %{count} unique user"
other: "Flagged by %{count} unique users"
+ similar_posts: "Past violations"
flagged_in_timeframe:
one: "%{count} confirmed flag"
other: "%{count} confirmed flags"
diff --git a/frontend/discourse/app/components/reviewable-refresh/insights.gjs b/frontend/discourse/app/components/reviewable-refresh/insights.gjs
index 73231db939f..c55dfb071c5 100644
--- a/frontend/discourse/app/components/reviewable-refresh/insights.gjs
+++ b/frontend/discourse/app/components/reviewable-refresh/insights.gjs
@@ -96,21 +96,28 @@ export default class ReviewableInsights extends Component {
});
}
- const moderationActions = [
- i18n("review.insights.moderation_history.silenced", {
- count: user.silenced_count,
- }),
- i18n("review.insights.moderation_history.suspended", {
- count: user.suspended_count,
- }),
- i18n("review.insights.moderation_history.rejected_posts", {
- count: user.rejected_posts_count,
- }),
- ];
- insights.push({
- label: i18n("review.insights.moderation_history.label"),
- description: moderationActions.join(", "),
- });
+ if (
+ user &&
+ (user.silenced_count !== undefined ||
+ user.suspended_count !== undefined ||
+ user.rejected_posts_count !== undefined)
+ ) {
+ const moderationActions = [
+ i18n("review.insights.moderation_history.silenced", {
+ count: user.silenced_count,
+ }),
+ i18n("review.insights.moderation_history.suspended", {
+ count: user.suspended_count,
+ }),
+ i18n("review.insights.moderation_history.rejected_posts", {
+ count: user.rejected_posts_count,
+ }),
+ ];
+ insights.push({
+ label: i18n("review.insights.moderation_history.label"),
+ description: moderationActions.join(", "),
+ });
+ }
return insights;
}