Skip to content

Conversation

@diegolmello
Copy link
Member

@diegolmello diegolmello commented Nov 5, 2025

Proposed changes

  • Added abac-removed-user-from-room system message
  • Added stories and snapshots
  • Added i18n for all languages
  • Added stories and snapshots for unsupported system message

Issue(s)

https://rocketchat.atlassian.net/browse/ABAC-66

How to test or reproduce

Screenshots

image image

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • New Features
    • Added system message notifications displayed when users are removed via ABAC policy
    • Added multilingual support with translations across 25+ languages for global user accessibility

@diegolmello diegolmello temporarily deployed to approve_e2e_testing November 5, 2025 17:06 — with GitHub Actions Inactive
@diegolmello diegolmello changed the base branch from develop to feat.abac November 5, 2025 17:06
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Walkthrough

This pull request adds support for a new system message type abac-removed-user-from-room to display when users are automatically removed by ABAC policies. The change includes type definitions, message handling logic, UI storybook examples, and localized strings across 23 languages.

Changes

Cohort / File(s) Change Summary
Message Type Definition
app/definitions/IMessage.ts
Updated the MessageTypesValues union type to include the new literal 'abac-removed-user-from-room'
Message Handling Logic
app/containers/message/utils.ts
Extended the message type switch logic to handle 'abac-removed-user-from-room', returning the translation key 'abac_removed_user_from_the_room' and including it in the list of types requiring an author name
UI Stories
app/containers/message/Message.stories.tsx
Added two new system message entries (abac-removed-user-from-room) to both SystemMessages and SystemMessagesLargeFont story variants
Translations
app/i18n/locales/{ar,bn-IN,cs,de,en,es,fi,fr,hi-IN,hu,it,ja,nl,nn,no,pt-BR,pt-PT,ru,sl-SI,sv,ta-IN,te-IN,tr,zh-CN,zh-TW}.json
Added localized translation entries for the key abac_removed_user_from_the_room across 25 language locales, each with locale-appropriate phrasing indicating user removal by ABAC

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • The core logic additions are minimal (single switch case in utils.ts and one type union update)
  • Translation additions follow a homogeneous pattern across all locale files, reducing per-file review complexity
  • Areas requiring attention: Verify translation accuracy and cultural appropriateness across all 25 language locales; ensure the utils.ts switch case logic aligns with how other similar system message types handle author name formatting

Poem

🐰 A hop, a skip, a new message type,
ABAC removals now get their script,
Twenty-five tongues join the celebration,
System messages in every nation!
✨🌍

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: adding a system message when members are removed by ABAC, which directly matches the changeset modifications across message types, utilities, type definitions, and all localization files.
Linked Issues check ✅ Passed The PR fully addresses ABAC-66 objectives: adds the abac-removed-user-from-room system message type, provides localized strings for all languages, updates message utilities and type definitions, and includes story snapshots for UI consistency.
Out of Scope Changes check ✅ Passed All changes are directly scoped to ABAC-66: message type addition, i18n translations, utility functions, type definitions, and stories for the new system message. No unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch abac-66

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@diegolmello diegolmello marked this pull request as ready for review November 5, 2025 17:07
@diegolmello diegolmello requested a deployment to experimental_android_build November 5, 2025 17:09 — with GitHub Actions Waiting
@diegolmello diegolmello requested a deployment to official_android_build November 5, 2025 17:09 — with GitHub Actions Waiting
@diegolmello diegolmello requested a deployment to experimental_ios_build November 5, 2025 17:09 — with GitHub Actions Waiting
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
app/i18n/locales/cs.json (1)

15-15: Optional wording tweak for naturalness in Czech.

Current: “byl odstraněn pomocí ABAC” can read like “removed using ABAC”. Consider “byl odstraněn systémem ABAC” or “byl odebrán systémem ABAC” for agentive “by”.

app/i18n/locales/ru.json (1)

15-15: Russian phrasing: avoid apostrophe and make gender‑neutral.

Suggest “удалён(а) политикой ABAC” for naturalness and neutrality.

-  "abac_removed_user_from_the_room": "был удалён ABAC'ом",
+  "abac_removed_user_from_the_room": "удалён(а) политикой ABAC",
app/i18n/locales/ja.json (1)

11-11: Optional JP style tweak.

Current is fine. If you prefer the common formal style: “ABACにより削除されました”.

-  "abac_removed_user_from_the_room": "ABACによって削除されました",
+  "abac_removed_user_from_the_room": "ABACにより削除されました",
app/i18n/locales/fr.json (1)

11-11: French gender agreement.

Consider “supprimé(e)” to cover neutral agreement after the username.

-  "abac_removed_user_from_the_room": "a été supprimé par ABAC",
+  "abac_removed_user_from_the_room": "a été supprimé(e) par ABAC",
app/i18n/locales/pt-BR.json (1)

15-15: Portuguese gender neutrality (optional).

If you want to avoid gender bias after the username, consider “removido(a)”.

-  "abac_removed_user_from_the_room": "foi removido pelo ABAC",
+  "abac_removed_user_from_the_room": "foi removido(a) pelo ABAC",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dd0b6fa and c9b8a39.

⛔ Files ignored due to path filters (1)
  • app/containers/message/__snapshots__/Message.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (28)
  • app/containers/message/Message.stories.tsx (2 hunks)
  • app/containers/message/utils.ts (2 hunks)
  • app/definitions/IMessage.ts (1 hunks)
  • app/i18n/locales/ar.json (1 hunks)
  • app/i18n/locales/bn-IN.json (1 hunks)
  • app/i18n/locales/cs.json (1 hunks)
  • app/i18n/locales/de.json (1 hunks)
  • app/i18n/locales/en.json (1 hunks)
  • app/i18n/locales/es.json (1 hunks)
  • app/i18n/locales/fi.json (1 hunks)
  • app/i18n/locales/fr.json (1 hunks)
  • app/i18n/locales/hi-IN.json (1 hunks)
  • app/i18n/locales/hu.json (1 hunks)
  • app/i18n/locales/it.json (1 hunks)
  • app/i18n/locales/ja.json (1 hunks)
  • app/i18n/locales/nl.json (1 hunks)
  • app/i18n/locales/nn.json (1 hunks)
  • app/i18n/locales/no.json (1 hunks)
  • app/i18n/locales/pt-BR.json (1 hunks)
  • app/i18n/locales/pt-PT.json (1 hunks)
  • app/i18n/locales/ru.json (1 hunks)
  • app/i18n/locales/sl-SI.json (1 hunks)
  • app/i18n/locales/sv.json (1 hunks)
  • app/i18n/locales/ta-IN.json (1 hunks)
  • app/i18n/locales/te-IN.json (1 hunks)
  • app/i18n/locales/tr.json (1 hunks)
  • app/i18n/locales/zh-CN.json (1 hunks)
  • app/i18n/locales/zh-TW.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ESLint and Test / run-eslint-and-test
🔇 Additional comments (24)
app/i18n/locales/fi.json (1)

15-15: ABAC removal string added — LGTM.

Translation reads correctly and matches system-message style.

app/i18n/locales/ar.json (1)

11-11: ABAC removal string added — LGTM.

Wording fits “was removed by ABAC”; no punctuation, as expected.

app/i18n/locales/it.json (1)

15-15: ABAC removal string added — LGTM.

Consistent with other system messages.

app/i18n/locales/es.json (1)

11-11: ABAC removal string added — LGTM.

Matches expected pattern; no terminal punctuation.

app/i18n/locales/nn.json (1)

10-10: ABAC removal string added — LGTM.

Natural phrasing; consistent style.

app/i18n/locales/sl-SI.json (1)

15-15: ABAC removal string added — LGTM.

Reads naturally; consistent with system-message pattern.

app/i18n/locales/tr.json (1)

11-11: LGTM (TR).

Translation is clear and idiomatic.

app/i18n/locales/hi-IN.json (1)

15-15: LGTM (HI).

Natural and consistent with system message style.

app/i18n/locales/hu.json (1)

15-15: LGTM (HU).

Clear and idiomatic.

app/i18n/locales/te-IN.json (1)

15-15: Translation shape LGTM.

Reads correctly after a username; formatting is consistent.

app/i18n/locales/nl.json (1)

11-11: Dutch entry looks good.

Correct post-username wording; consistent with other system messages.

app/i18n/locales/ta-IN.json (1)

15-15: Tamil entry OK.

Works grammatically after a username; no JSON issues spotted.

app/i18n/locales/zh-CN.json (1)

11-11: Simplified Chinese entry OK.

Natural after username; style matches other info messages.

app/i18n/locales/zh-TW.json (1)

11-11: Traditional Chinese entry OK.

Reads correctly appended to a username; formatting consistent.

app/i18n/locales/no.json (1)

15-15: Norwegian entry looks good.

Post-username wording is correct; consistent with existing system message tone.

app/i18n/locales/sv.json (1)

15-15: ABAC system message key verified — all wiring is consistent.

Type-to-key mapping confirmed: 'abac-removed-user-from-room' routes correctly to 'abac_removed_user_from_the_room' in getInfoMessage, the type is defined in MessageTypesValues, the Swedish translation exists, and both Storybook variants cover the new message type.

app/i18n/locales/de.json (1)

15-15: LGTM! Translation added correctly.

The German translation for the new ABAC removal system message has been added in the correct alphabetical position and follows the existing format.

app/i18n/locales/bn-IN.json (1)

15-15: LGTM! Bengali translation added correctly.

The translation key is properly positioned and follows the established i18n pattern.

app/containers/message/Message.stories.tsx (2)

1965-1966: LGTM! Story entries added for new system message types.

Both the new abac-removed-user-from-room system message and the unsupported fallback example have been added correctly. These story entries will help document and visualize the new message type in Storybook.


2008-2009: LGTM! Large font variants added consistently.

The large font story variants mirror the standard stories correctly, ensuring the new message types render properly across different font scales.

app/i18n/locales/pt-PT.json (1)

11-11: LGTM! Portuguese translation added correctly.

The translation is properly positioned alphabetically and follows the established i18n structure.

app/containers/message/utils.ts (2)

78-79: LGTM! Message type correctly added to author name list.

Adding 'abac-removed-user-from-room' to the messagesWithAuthorName array is consistent with other system messages that display the author's name in the UI, even when the author name isn't interpolated into the message text itself.


163-164: LGTM! Translation handler added correctly.

The new case returns the appropriate translation key without dynamic interpolation, which is consistent with other simple system messages like 'room_archived' and 'room_unarchived'. The implementation follows the established pattern.

app/definitions/IMessage.ts (1)

253-254: LGTM! Message type added to union correctly.

The new 'abac-removed-user-from-room' literal type has been added to the MessageTypesValues union, ensuring type safety throughout the codebase. The placement at the end of the union is appropriate.

"A11y_in_app_notification": "New message from {{name}}: {{message}}",
"A11y_incoming_call_dismiss": "Dismiss",
"A11y_incoming_call_swipe_down_to_view_options": "Swipe down to view options",
"abac_removed_user_from_the_room": "was removed by ABAC",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

ABAC removal base string added — LGTM.

English baseline looks good and matches web-style phrasing.

Run to verify coverage and wiring:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Ensure every locale defines abac_removed_user_from_the_room"
missing=0
for f in $(fd -t f . app/i18n/locales -e json | sort); do
  if ! jq -e 'has("abac_removed_user_from_the_room")' "$f" >/dev/null; then
    echo "Missing in: $f"
    missing=1
  fi
done
test $missing -eq 0 && echo "All locales have the key."

echo "2) Sanity-check spacing/casing (no leading/trailing spaces; lower-case start)"
issues=0
while IFS= read -r f; do
  val=$(jq -r '."abac_removed_user_from_the_room" // empty' "$f")
  [[ -z "$val" ]] && continue
  if [[ "$val" =~ ^[[:space:]]|[[:space:]]$ ]]; then
    echo "Trim spaces in: $f => '$val'"
    issues=1
  fi
done < <(fd -t f . app/i18n/locales -e json | sort)
test $issues -eq 0 && echo "No leading/trailing spaces found."

echo "3) Check type mapping and message utils"
rg -n "abac-removed-user-from-room|abac_removed_user_from_the_room" app/definitions/IMessage.ts app/containers/message/utils.ts app/containers/message/Message.stories.tsx

Length of output: 1783


ABAC removal string is incomplete — missing from 41+ locale files.

The key abac_removed_user_from_the_room is only present in en.json but is missing from all other locales (af, az, bas-CM, be-BY, bg, bn-BD, bs, ca, cy, da, de-AT, el, eo, et, eu, fa, gl, he, hr, id, ka-GE, kg, km, ko, ku, ln, lo, lt, lv, mn, ms-MY, pl, ro, si, sk-SK, sq, sr, th-TH, ug, uk, vi-VN, zh-HK, and others).

Add the key and appropriate translations to all locale files under app/i18n/locales/.

🤖 Prompt for AI Agents
In app/i18n/locales/en.json around line 15, the key
"abac_removed_user_from_the_room" is present but missing across 41+ other locale
files; add this key to every file under app/i18n/locales/ (e.g., af, az, bas-CM,
be-BY, bg, bn-BD, bs, ca, cy, da, de-AT, el, eo, et, eu, fa, gl, he, hr, id,
ka-GE, kg, km, ko, ku, ln, lo, lt, lv, mn, ms-MY, pl, ro, si, sk-SK, sq, sr,
th-TH, ug, uk, vi-VN, zh-HK, etc.) with appropriate translations matching the
English meaning "was removed by ABAC"; ensure each locale file uses its existing
JSON formatting, place the new key alongside similar room/user message keys, and
run a JSON validation/lint pass to confirm no syntax errors.

Copy link
Contributor

@OtavioStasiak OtavioStasiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants