feat(ABAC): Add room attributes to room info#6761
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds ABAC support: changes abacAttributes from string[] to { name: string; values: string[] }[], adds RoomInfoABAC/RoomInfoTag/ItemLabel components, integrates ABAC UI into Room Info and Channel, updates stories/tests/helpers/types, adds i18n keys, and gates some message actions with disabledReason. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant Channel
participant RoomInfoView
participant RoomInfoABAC
participant RoomInfoTag
participant I18n
User->>Channel: open room / view Room Info
Channel->>RoomInfoView: pass room (abacAttributes, teamMain)
RoomInfoView->>RoomInfoABAC: render with props
RoomInfoABAC->>I18n: request ABAC_managed, ABAC_managed_description, ABAC_room_attributes
I18n-->>RoomInfoABAC: localized strings
RoomInfoABAC->>RoomInfoABAC: iterate abacAttributes
loop per attribute
RoomInfoABAC->>RoomInfoTag: render attribute name and value tags
RoomInfoTag-->>RoomInfoABAC: badge(s) rendered
end
RoomInfoABAC-->>RoomInfoView: ABAC section ready
RoomInfoView-->>User: display Room Info with ABAC attributes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (25)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/i18n/locales/nl.json (1)
1-1: Critical i18n consistency issues foundVerification confirms two problems:
Missing ABAC keys:
ABAC_room_attributes,ABAC_managed, andABAC_managed_descriptionare missing from 48 locale files (af.json, az.json, bas-CM.json, be-BY.json, bg.json, bn-BD.json, bs.json, ca.json, cy.json, da.json, de-AT.json, el.json, eo.json, et.json, eu.json, fa.json, gl.json, he.json, hr.json, id.json, ka-GE.json, kg.json, km.json, ko.json, ku.json, ln.json, lo.json, lt.json, lv.json, mn.json, ms-MY.json, pl.json, ro.json, si.json, sk-SK.json, sq.json, sr.json, th-TH.json, ug.json, uk.json, vi-VN.json, zh-HK.json). These keys must be added to all locales to maintain consistency.Double-space in nn.json line 399:
"Your_invite_link_will_expire_on__date__or_after__usesLeft__uses": "Invitasjonskoblingen din utløper {{date}} eller etter {{usesLeft}} anvendelser."contains two spaces before{{usesLeft}}; remove the extra space.
🧹 Nitpick comments (14)
app/i18n/locales/en.json (1)
998-1001: Polish wording (hyphenation and clarity).Tighten phrasing for consistency with style used elsewhere.
- "ABAC_managed": "ABAC managed", - "ABAC_managed_description": "Only compliant users have access to attribute-based access controlled rooms. Attributes determine room access." + "ABAC_managed": "ABAC-managed", + "ABAC_managed_description": "Only compliant users can access attribute-based, access-controlled rooms. Attributes determine room access."app/i18n/locales/zh-TW.json (1)
653-656: Minor zh-TW copy smoothing (optional).- "ABAC_managed": "ABAC 管理", - "ABAC_managed_description": "只有符合條件的使用者才能存取基於屬性的存取控制房間。屬性決定房間存取權限。" + "ABAC_managed": "由 ABAC 管理", + "ABAC_managed_description": "只有符合規範的使用者才能存取採用屬性為基礎存取控制的房間。屬性決定房間的存取權限。"Please confirm with your zh-TW reviewer.
app/i18n/locales/zh-CN.json (1)
624-627: Minor zh-CN copy smoothing (optional).- "ABAC_managed": "ABAC 管理", - "ABAC_managed_description": "只有符合条件的用户才能访问基于属性的访问控制房间。属性决定房间访问权限。" + "ABAC_managed": "由 ABAC 管理", + "ABAC_managed_description": "只有合规的用户才能访问采用基于属性的访问控制的房间。属性决定房间的访问权限。"Please confirm with your zh-CN reviewer.
app/i18n/locales/de.json (1)
885-888: Improve German terminology (optional).Use conventional ABAC phrasing and hyphenation.
- "ABAC_managed": "ABAC verwaltet", - "ABAC_managed_description": "Nur konforme Benutzer haben Zugriff auf attributbasierte zugriffsgesteuerte Räume. Attribute bestimmen den Raumzugriff." + "ABAC_managed": "ABAC-verwaltet", + "ABAC_managed_description": "Nur konforme Nutzer haben Zugriff auf attributbasierte, zugriffskontrollierte Räume. Attribute bestimmen den Raumzugriff."app/i18n/locales/cs.json (1)
970-973: Naturalize Czech phrasing (optional).- "ABAC_managed": "Spravováno ABAC", - "ABAC_managed_description": "Pouze vyhovující uživatelé mají přístup k místnostem řízeným přístupem na základě atributů. Atributy určují přístup k místnosti." + "ABAC_managed": "Spravováno systémem ABAC", + "ABAC_managed_description": "Pouze vyhovující uživatelé mají přístup k místnostem se správou přístupu na základě atributů. Atributy určují přístup do místnosti."app/i18n/locales/nl.json (1)
779-782: Refine Dutch phrasing for clarity and idiomSuggest replacing “conforme gebruikers” and improving ABAC phrasing.
- "ABAC_managed": "ABAC beheerd", - "ABAC_managed_description": "Alleen conforme gebruikers hebben toegang tot op attributen gebaseerde toegangsgecontroleerde kamers. Attributen bepalen de toegang tot de kamer." + "ABAC_managed": "Door ABAC beheerd", + "ABAC_managed_description": "Alleen geautoriseerde gebruikers hebben toegang tot kamers met attributengebaseerde toegangscontrole. Attributen bepalen de toegangsrechten tot de kamer."app/i18n/locales/sv.json (1)
855-859: Polish Swedish ABAC wording“åtkomstskyddade” reads odd here; prefer “åtkomstkontrollerade”.
- "ABAC_room_attributes": "Rumsattribut", - "ABAC_managed": "ABAC-hanterat", - "ABAC_managed_description": "Endast kompatibla användare har åtkomst till attributbaserat åtkomstskyddade rum. Attributen avgör tillgången till rummet." + "ABAC_room_attributes": "Rumsattribut", + "ABAC_managed": "ABAC-hanterat", + "ABAC_managed_description": "Endast behöriga användare har åtkomst till attributbaserat åtkomstkontrollerade rum. Attribut avgör åtkomsten till rummet."app/i18n/locales/nn.json (1)
399-403: Remove double space; keep ABAC keysThere’s a double space before {{usesLeft}} on Line 399.
- "Your_invite_link_will_expire_on__date__or_after__usesLeft__uses": "Invitasjonskoblingen din utløper {{date}} eller etter {{usesLeft}} anvendelser.", + "Your_invite_link_will_expire_on__date__or_after__usesLeft__uses": "Invitasjonskoblingen din utløper {{date}} eller etter {{usesLeft}} anvendelser."app/i18n/locales/hi-IN.json (1)
895-898: Tighten Hindi phrasingUse “अधिकृत उपयोगकर्ता” and simplify.
- "ABAC_managed_description": "केवल संगत उपयोगकर्ताओं के पास विशेषता-आधारित पहुँच नियंत्रित कमरों तक पहुँच है। विशेषताएँ कमरे तक पहुँच निर्धारित करती हैं।" + "ABAC_managed_description": "केवल अधिकृत उपयोगकर्ताओं को विशेषता‑आधारित एक्सेस‑नियंत्रित कमरों तक पहुँच होती है। विशेषताएँ कमरे की पहुँच निर्धारित करती हैं।"app/i18n/locales/es.json (1)
451-455: Improve Spanish clarity; mention ABAC explicitly“usuarios compatibles” sounds odd here; use “autorizados” and clarify ABAC.
- "ABAC_managed": "Gestionado por ABAC", - "ABAC_managed_description": "Solo los usuarios compatibles tienen acceso a las salas controladas por acceso basado en atributos. Los atributos determinan el acceso a la sala." + "ABAC_managed": "Administrado por ABAC", + "ABAC_managed_description": "Solo los usuarios autorizados pueden acceder a salas con control de acceso basado en atributos (ABAC). Los atributos determinan el acceso a la sala."app/views/RoomInfoView/Item.tsx (1)
14-23: Consider testID uniqueness for better test targeting.The same
testIDis applied to both the containerView(line 18) and the nestedItemLabel(line 19). When a label exists, this creates two elements with identical testIDs, which could make it harder to target specific elements in tests.Consider either:
- Using distinct testIDs (e.g.,
testIDfor container,${testID}-labelfor ItemLabel)- Applying testID only to the container if that's the intended test target
app/views/RoomInfoView/index.tsx (1)
287-287: LGTM! Bottom padding added for content spacing.The padding adjustment properly accommodates the new ABAC sections being rendered in RoomInfoView.
Optional enhancement: Consider extracting the padding value (30) to a theme constant or the styles file for better maintainability, though the current implementation is acceptable.
app/lib/methods/helpers/mergeSubscriptionsRooms.ts (1)
37-41: Verify the TODO is tracked for removing mock data.The hardcoded mock ABAC attributes align with the PR's stated testing approach. However, ensure this TODO is tracked in an issue or backlog item so the mock data is replaced with actual server-provided attributes before production release.
app/views/RoomInfoView/components/RoomInfoABAC.tsx (1)
26-27: Consider extracting inline styles for consistency.The inline styles for
marginBottomandgapcould be moved to the styles file to maintain consistency with the rest of the codebase.Apply this diff to extract the styles:
+// In app/views/RoomInfoView/styles.ts, add: +abacContainer: { + gap: 16 +}, +abacSeparator: { + marginBottom: 20 +}Then update the component:
-<List.Separator style={{ marginBottom: 20 }} /> -<View style={{ gap: 16 }}> +<List.Separator style={styles.abacSeparator} /> +<View style={styles.abacContainer}>
📜 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.
⛔ Files ignored due to path filters (1)
app/views/RoomInfoView/components/__snapshots__/RoomInfoABAC.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (40)
app/containers/RoomHeader/RoomHeader.stories.tsx(1 hunks)app/containers/RoomItem/RoomItem.stories.tsx(1 hunks)app/containers/RoomTypeIcon/RoomTypeIcon.stories.tsx(1 hunks)app/definitions/ISubscription.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)app/lib/methods/helpers/mergeSubscriptionsRooms.ts(1 hunks)app/views/RoomInfoView/Channel.tsx(2 hunks)app/views/RoomInfoView/Direct.tsx(2 hunks)app/views/RoomInfoView/Item.tsx(2 hunks)app/views/RoomInfoView/components/ItemLabel.tsx(1 hunks)app/views/RoomInfoView/components/RoomInfoABAC.stories.tsx(1 hunks)app/views/RoomInfoView/components/RoomInfoABAC.test.tsx(1 hunks)app/views/RoomInfoView/components/RoomInfoABAC.tsx(1 hunks)app/views/RoomInfoView/components/RoomInfoTag.tsx(1 hunks)app/views/RoomInfoView/index.tsx(1 hunks)app/views/RoomInfoView/styles.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (8)
app/views/RoomInfoView/components/RoomInfoTag.tsx (2)
app/containers/CustomIcon/index.tsx (2)
TIconsName(13-13)CustomIcon(38-38)app/theme.tsx (1)
useTheme(29-29)
app/views/RoomInfoView/Channel.tsx (1)
app/views/RoomInfoView/components/RoomInfoABAC.tsx (1)
RoomInfoABAC(11-48)
app/views/RoomInfoView/components/RoomInfoABAC.stories.tsx (3)
app/views/RoomInfoView/components/RoomInfoABAC.tsx (1)
RoomInfoABAC(11-48)app/theme.tsx (2)
TSupportedThemes(8-8)ThemeContext(18-18)app/lib/constants/colors.ts (1)
colors(280-302)
app/views/RoomInfoView/components/RoomInfoABAC.tsx (4)
app/definitions/ISubscription.ts (1)
ISubscription(40-120)app/theme.tsx (1)
useTheme(29-29)app/views/RoomInfoView/components/RoomInfoTag.tsx (2)
RoomInfoTagContainer(20-22)RoomInfoTag(9-18)app/views/RoomInfoView/components/ItemLabel.tsx (1)
ItemLabel(11-18)
app/views/RoomInfoView/components/ItemLabel.tsx (2)
app/theme.tsx (1)
useTheme(29-29)app/lib/constants/colors.ts (1)
colors(280-302)
app/views/RoomInfoView/Direct.tsx (1)
app/views/RoomInfoView/components/RoomInfoTag.tsx (2)
RoomInfoTagContainer(20-22)RoomInfoTag(9-18)
app/views/RoomInfoView/components/RoomInfoABAC.test.tsx (1)
.rnstorybook/generateSnapshots.tsx (1)
generateSnapshots(10-22)
app/views/RoomInfoView/Item.tsx (1)
app/views/RoomInfoView/components/ItemLabel.tsx (1)
ItemLabel(11-18)
🔇 Additional comments (33)
app/i18n/locales/ar.json (1)
632-635: LGTM (Arabic ABAC strings).Translations read well and keys match usage. No issues.
app/i18n/locales/pt-BR.json (1)
982-985: LGTM (pt-BR ABAC strings).Consistent with existing terminology. No changes needed.
app/i18n/locales/nl.json (1)
778-781: JSON hygiene checkTrailing comma was added above; ensure there’s no trailing comma after the last property in the object. Looks good here.
Run the validation script in my later comment to double‑check all locale files parse.
app/i18n/locales/te-IN.json (1)
894-897: LGTM — Telugu additions read well“గది లక్షణాలు”, “ABAC నిర్వహించబడింది” and the description are clear.
app/i18n/locales/nn.json (1)
400-403: Wording OK“ABAC-administrert” and description look correct for Nynorsk.
app/i18n/locales/ja.json (1)
551-555: LGTM — Japanese ABAC strings“ABAC管理” and the description read naturally.
app/i18n/locales/pt-PT.json (1)
512-516: LGTM! ABAC localization keys added correctly.The Portuguese translations for ABAC attributes are properly structured and the JSON formatting is correct with the trailing comma adjustment.
app/i18n/locales/no.json (1)
944-948: LGTM! Norwegian ABAC translations added.The Norwegian translations follow the consistent pattern established across other locales.
app/i18n/locales/sl-SI.json (1)
793-796: LGTM! Slovenian ABAC translations added.The translations are consistent with the pattern established across all locale files in this PR.
app/views/RoomInfoView/components/RoomInfoTag.tsx (1)
1-22: LGTM! Well-structured reusable components.The
RoomInfoTagandRoomInfoTagContainercomponents are cleanly implemented with:
- Proper theming integration
- Conditional icon rendering
- TypeScript type safety with
TIconsName- Test support via
testIDThese components promote good code reuse across RoomInfoView.
app/views/RoomInfoView/Direct.tsx (1)
10-29: LGTM! Clean refactor using shared components.The refactoring successfully replaces inline badge rendering with the reusable
RoomInfoTagcomponents. The testID generation properly handles spaces in role names, maintaining good test support.app/views/RoomInfoView/styles.ts (2)
13-77: LGTM! Style updates support new tag-based layout.The style changes improve spacing and typography for the refactored components:
- Added
gapproperties for cleaner spacing (requires React Native 0.71+)- Refined badge styling with better padding and border radius
- Typography adjustments support the new tag rendering
97-101: LGTM! ABAC description styling added.The new
abacDescriptionstyle has appropriate line height ratio (1.375) for readability.app/i18n/locales/fi.json (1)
857-860: LGTM! Finnish ABAC translations added.The Finnish translations complete the multi-language support for ABAC attributes, maintaining consistency with the other 24+ locales updated in this PR.
app/i18n/locales/ru.json (1)
825-828: LGTM! ABAC localization keys added.The Russian translations for ABAC-related room attributes have been properly added to support the new feature.
app/i18n/locales/fr.json (1)
778-781: LGTM! French ABAC translations added.The French localization keys are properly added and align with the ABAC feature implementation.
app/views/RoomInfoView/components/ItemLabel.tsx (1)
1-18: LGTM! Clean and reusable component.This ItemLabel component is well-structured with proper theming, TypeScript typing, and accessibility support. It's a good refactor for centralizing label rendering across the RoomInfoView.
app/views/RoomInfoView/components/RoomInfoABAC.test.tsx (1)
1-4: LGTM! Snapshot tests properly configured.The test file follows the project's standard pattern for generating component snapshots from Storybook stories.
app/containers/RoomItem/RoomItem.stories.tsx (1)
74-75: LGTM! ABAC attributes updated to new structure.The story updates correctly reflect the migration from string arrays to structured objects with
nameandvaluesproperties. Testing both with and withoutteamMainprovides good coverage.app/views/RoomInfoView/Channel.tsx (1)
6-6: LGTM! Clean ABAC component integration.The RoomInfoABAC component is properly imported and integrated into the Channel view with appropriate prop passing and safe optional chaining.
Also applies to: 19-19
app/i18n/locales/tr.json (1)
664-667: LGTM! Turkish ABAC translations added.The Turkish localization keys are properly added, completing the i18n support for the ABAC feature across multiple languages.
app/definitions/ISubscription.ts (1)
119-119: LGTM!The type change from
string[]to an array of structured objects properly reflects the enhanced ABAC attribute model. The new shape withnameandvaluesprovides better semantic clarity and aligns with the related UI components and stories updated throughout this PR.app/i18n/locales/hu.json (1)
898-901: LGTM!The Hungarian translations for ABAC keys are properly formatted and consistent with the localization pattern used across other locale files in this PR.
app/i18n/locales/ta-IN.json (1)
895-898: LGTM!The Tamil translations for ABAC keys are properly formatted and consistent with the localization pattern used across other locale files in this PR.
app/views/RoomInfoView/components/RoomInfoABAC.stories.tsx (2)
21-31: LGTM!The Story component provides good test coverage with two scenarios: one with
teamMainflag and a single attribute, and another with multiple attributes including a stress-test case with 10 values. This demonstrates both typical and edge-case rendering.
33-53: LGTM!The ThemeProvider implementation and theme story variants (Light, Dark, Black) follow standard Storybook patterns and provide comprehensive visual testing across all supported themes.
app/containers/RoomTypeIcon/RoomTypeIcon.stories.tsx (1)
21-22: LGTM!The story updates correctly reflect the new structured
abacAttributesformat and provide test coverage for both standard and team-based ABAC scenarios.app/i18n/locales/it.json (1)
681-684: LGTM!The Italian translations for ABAC keys are properly formatted and consistent with the localization pattern used across other locale files in this PR.
app/containers/RoomHeader/RoomHeader.stories.tsx (1)
58-72: LGTM!The new story examples correctly demonstrate ABAC-attributed rooms with the updated structured format. The inclusion of both standard and team variants provides comprehensive visual testing coverage.
app/views/RoomInfoView/components/RoomInfoABAC.tsx (4)
1-9: LGTM! Clean imports.All imports are used and properly organized.
11-17: LGTM! Props are correctly typed.The component signature correctly references
ISubscription['abacAttributes']and both props are appropriately optional.
18-22: LGTM! Proper null handling.The early return with optional chaining correctly handles undefined, null, and empty arrays.
32-34: LGTM! Proper theme usage.Correctly applies theme colors and uses i18n for internationalization.
app/i18n/locales/bn-IN.json
Outdated
| "Your_workspace": "আপনার ওয়ার্কস্পেস", | ||
| "ABAC_room_attributes": "রুমের বৈশিষ্ট্য", | ||
| "ABAC_managed": "ABAC দ্বারা পরিচালিত", | ||
| "ABAC_managed_description": "শুধুমাত্র অনুগত ব্যবহারকারীদের অ্যাট্রিবিউট-ভিত্তিক অ্যাক্সেস নিয়ন্ত্রিত রুমগুলিতে অ্যাক্সেস আছে। অ্যাট্রিবিউটগুলি রুমের অ্যাক্সেস নির্ধারণ করে।" | ||
| } No newline at end of file |
There was a problem hiding this comment.
Fix Bengali semantics (“অনুগত” → “অনুমোদিত”)
“অনুগত” means obedient, not compliant/authorized.
- "ABAC_managed_description": "শুধুমাত্র অনুগত ব্যবহারকারীদের অ্যাট্রিবিউট-ভিত্তিক অ্যাক্সেস নিয়ন্ত্রিত রুমগুলিতে অ্যাক্সেস আছে। অ্যাট্রিবিউটগুলি রুমের অ্যাক্সেস নির্ধারণ করে।"
+ "ABAC_managed_description": "শুধুমাত্র অনুমোদিত ব্যবহারকারীদের অ্যাট্রিবিউট-ভিত্তিক অ্যাক্সেস-নিয়ন্ত্রিত রুমে প্রবেশাধিকার থাকে। অ্যাট্রিবিউটগুলো রুমে প্রবেশ নির্ধারণ করে।"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "Your_workspace": "আপনার ওয়ার্কস্পেস", | |
| "ABAC_room_attributes": "রুমের বৈশিষ্ট্য", | |
| "ABAC_managed": "ABAC দ্বারা পরিচালিত", | |
| "ABAC_managed_description": "শুধুমাত্র অনুগত ব্যবহারকারীদের অ্যাট্রিবিউট-ভিত্তিক অ্যাক্সেস নিয়ন্ত্রিত রুমগুলিতে অ্যাক্সেস আছে। অ্যাট্রিবিউটগুলি রুমের অ্যাক্সেস নির্ধারণ করে।" | |
| } | |
| "Your_workspace": "আপনার ওয়ার্কস্পেস", | |
| "ABAC_room_attributes": "রুমের বৈশিষ্ট্য", | |
| "ABAC_managed": "ABAC দ্বারা পরিচালিত", | |
| "ABAC_managed_description": "শুধুমাত্র অনুমোদিত ব্যবহারকারীদের অ্যাট্রিবিউট-ভিত্তিক অ্যাক্সেস-নিয়ন্ত্রিত রুমে প্রবেশাধিকার থাকে। অ্যাট্রিবিউটগুলো রুমে প্রবেশ নির্ধারণ করে।" | |
| } |
🤖 Prompt for AI Agents
In app/i18n/locales/bn-IN.json around lines 895 to 899, the Bengali word "অনুগত"
in the value for "ABAC_managed_description" is semantically incorrect; replace
"অনুগত ব্যবহারকারীদের" with "অনুমোদিত ব্যবহারকারীদের" so the phrase reads about
authorized/compliant users instead of obedient users, preserving the rest of the
string and JSON formatting.
app/i18n/locales/en.json
Outdated
| "Your_push_was_sent_to_s_devices": "Your push was sent to {{s}} devices", | ||
| "ABAC_room_attributes": "Room attributes", | ||
| "ABAC_managed": "ABAC managed", | ||
| "ABAC_managed_description": "Only compliant users have access to attribute-based access controlled rooms. Attributes determine room access." |
There was a problem hiding this comment.
🧩 Analysis chain
Verify all locales include the three ABAC keys and valid JSON.
Run to confirm presence across app/i18n/locales/*.json and detect parse errors.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cd app/i18n/locales
# Fail fast on invalid JSON
echo "Validating JSON…"
fd -e json -x sh -c 'jq empty "$0"' {}
echo "Checking ABAC keys exist in each locale…"
missing=0
while IFS= read -r f; do
if ! jq -e 'has("ABAC_room_attributes") and has("ABAC_managed") and has("ABAC_managed_description")' "$f" >/dev/null; then
echo "Missing ABAC keys in: $f"
missing=1
fi
done < <(fd -e json)
if [ "$missing" -eq 0 ]; then
echo "All locale files contain the ABAC keys."
else
echo "One or more locale files are missing ABAC keys." >&2
exit 1
fiLength of output: 115
I need to run an alternative script that avoids process substitution, which isn't available in this environment.
---
🏁 Script executed:
```shell
#!/bin/bash
set -euo pipefail
cd app/i18n/locales
echo "Validating JSON…"
for f in *.json; do
if ! jq empty "$f" 2>/dev/null; then
echo "Invalid JSON in: $f" >&2
exit 1
fi
done
echo "Checking ABAC keys exist in each locale…"
missing=0
for f in *.json; do
if ! jq -e 'has("ABAC_room_attributes") and has("ABAC_managed") and has("ABAC_managed_description")' "$f" >/dev/null 2>&1; then
echo "Missing ABAC keys in: $f"
missing=1
fi
done
if [ "$missing" -eq 0 ]; then
echo "All locale files contain the ABAC keys."
else
echo "One or more locale files are missing ABAC keys." >&2
exit 1
fi
Length of output: 1396
The verification revealed a critical issue. Let me identify which locales actually contain the ABAC keys:
---
🏁 Script executed:
```shell
#!/bin/bash
cd app/i18n/locales
echo "Locales WITH ABAC keys:"
for f in *.json; do
if jq -e 'has("ABAC_room_attributes") and has("ABAC_managed") and has("ABAC_managed_description")' "$f" >/dev/null 2>&1; then
echo " $f"
fi
done
Length of output: 300
The ABAC keys are missing from 43 out of 68 locale files—this must be fixed before merge.
Verification shows:
- ✓ All JSON files are valid
- ✗ Only 25 locales contain the ABAC keys (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)
- ✗ 43 locales are missing all three keys: 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
Add the missing ABAC keys to all 43 locale files.
🤖 Prompt for AI Agents
In app/i18n/locales/en.json around lines 998 to 1001, three ABAC-related keys
have been added (ABAC_room_attributes, ABAC_managed, and
ABAC_managed_description), but they are missing from 43 out of 68 locale files.
Add these three keys to all missing locale files: 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, and zh-HK. For each locale file, translate the three ABAC keys
appropriately into the target language while maintaining the same key names and
structure as shown in the en.json file.
| {abacAttributes.map(attribute => ( | ||
| <View key={attribute.name} style={{ gap: 8 }}> | ||
| <Text style={[styles.abacDescription, { color: colors.fontDefault }]}>{attribute.name}</Text> | ||
| <RoomInfoTagContainer> | ||
| {attribute.values.map(value => ( | ||
| <RoomInfoTag name={value} key={value} /> | ||
| ))} | ||
| </RoomInfoTagContainer> | ||
| </View> | ||
| ))} |
There was a problem hiding this comment.
Potential duplicate keys in values mapping.
Line 40 uses value directly as the key, which could cause React warnings and rendering issues if attribute.values contains duplicate entries. While unlikely, backend data issues or configuration errors could introduce duplicates.
Apply this diff to use index-based keys:
-{attribute.values.map(value => (
- <RoomInfoTag name={value} key={value} />
+{attribute.values.map((value, index) => (
+ <RoomInfoTag name={value} key={`${attribute.name}-${index}`} />
))}Additionally, the inline style on line 36 could be extracted to the styles file for consistency (similar to the comment on lines 26-27).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {abacAttributes.map(attribute => ( | |
| <View key={attribute.name} style={{ gap: 8 }}> | |
| <Text style={[styles.abacDescription, { color: colors.fontDefault }]}>{attribute.name}</Text> | |
| <RoomInfoTagContainer> | |
| {attribute.values.map(value => ( | |
| <RoomInfoTag name={value} key={value} /> | |
| ))} | |
| </RoomInfoTagContainer> | |
| </View> | |
| ))} | |
| {abacAttributes.map(attribute => ( | |
| <View key={attribute.name} style={{ gap: 8 }}> | |
| <Text style={[styles.abacDescription, { color: colors.fontDefault }]}>{attribute.name}</Text> | |
| <RoomInfoTagContainer> | |
| {attribute.values.map((value, index) => ( | |
| <RoomInfoTag name={value} key={`${attribute.name}-${index}`} /> | |
| ))} | |
| </RoomInfoTagContainer> | |
| </View> | |
| ))} |
🤖 Prompt for AI Agents
In app/views/RoomInfoView/components/RoomInfoABAC.tsx around lines 35 to 44, the
inner map uses value as the React key which can produce duplicate-key warnings
if attribute.values contains duplicates — change the key to use the index (or a
composite key like `${attribute.name}-${index}`) when mapping attribute.values
to RoomInfoTag components; also extract the inline style { gap: 8 } used on the
wrapping View into the stylesheet (add a named style in the styles file and
replace the inline object with that style reference) for consistency with
existing styles.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
app/i18n/locales/bn-IN.json (1)
15-18: Bengali translation issue already flagged.A past review comment has already identified a semantic issue with "অনুগত" (obedient) on line 17, which should be "অনুমোদিত" (compliant/authorized). Please refer to that comment for the correction.
🧹 Nitpick comments (1)
app/i18n/locales/es.json (1)
11-14: Verify Spanish translations with native speakers.The four new ABAC translation keys have been added. While the translations appear reasonable, consider having them reviewed by native Spanish speakers to ensure accuracy and naturalness, especially for technical terms like "ABAC" and "acceso basado en atributos."
📜 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.
📒 Files selected for processing (28)
app/containers/ActionSheet/Item.tsx(1 hunks)app/containers/ActionSheet/Provider.tsx(1 hunks)app/containers/MessageActions/index.tsx(2 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(2 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)
🚧 Files skipped from review as they are similar to previous changes (16)
- app/i18n/locales/ta-IN.json
- app/i18n/locales/de.json
- app/i18n/locales/pt-PT.json
- app/i18n/locales/hi-IN.json
- app/i18n/locales/pt-BR.json
- app/i18n/locales/fr.json
- app/i18n/locales/cs.json
- app/i18n/locales/sl-SI.json
- app/i18n/locales/en.json
- app/i18n/locales/nn.json
- app/i18n/locales/zh-TW.json
- app/i18n/locales/hu.json
- app/i18n/locales/fi.json
- app/i18n/locales/te-IN.json
- app/i18n/locales/ru.json
- app/i18n/locales/no.json
🧰 Additional context used
🧬 Code graph analysis (1)
app/containers/ActionSheet/Item.tsx (1)
app/containers/Toast.tsx (1)
LISTENER(24-24)
⏰ 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: format
🔇 Additional comments (9)
app/i18n/locales/nl.json (1)
11-14: ABAC localization keys properly formatted and alphabetically ordered.The four new Dutch translations for ABAC features are correctly added with proper JSON syntax, accurate semantic meaning, and consistent alphabetical placement. The strings align with the ABAC feature additions shown in related files (RoomInfoABAC component, room info UI enhancements).
app/i18n/locales/sv.json (1)
15-18: ABAC localization keys properly integrated.The four new Swedish locale entries for ABAC functionality are correctly formatted, alphabetically ordered, and follow the established naming conventions. JSON syntax is valid, and the Swedish translations are appropriate for the feature context.
app/i18n/locales/ar.json (1)
11-14: ABAC localization keys added consistently.The four new ABAC translation keys are properly formatted, correctly positioned within the alphabetical structure, and follow the codebase's naming conventions. The translations align with the broader ABAC feature rollout described in the PR.
app/i18n/locales/zh-CN.json (1)
11-14: JSON structure is correct and alphabetical ordering is maintained.The four new ABAC localization keys are properly formatted, correctly positioned in alphabetical order between A11y and Accessibility entries, and follow the consistent key-value format used throughout the file. The translations appear contextually appropriate for their intended use in the ABAC room attributes UI feature.
To ensure consistency across all locale files, please verify that these translations align with the corresponding keys in other locale files (e.g.,
en.json,es.json,fr.json,zh-TW.json, etc.) mentioned in the broader ABAC feature rollout.app/i18n/locales/tr.json (1)
11-14: ABAC translation keys are consistently added across all supported locales.The four ABAC translation keys in the Turkish locale are present across 20+ other locale files (ES, FR, DE, IT, JA, RU, ZH-CN, ZH-TW, PT-BR, NO, SV, etc.), confirming consistency across the localization system. The JSON formatting and key structure are correct.
However, direct code references to these keys were not found in TypeScript/JavaScript files. In Rocket.Chat's i18n system, translations are typically accessed dynamically at runtime (e.g., via
i18n.t('ABAC_managed')), so the absence of static references is expected. Verify in the corresponding UI components (e.g., RoomInfoABAC) that these keys are properly referenced through the i18n lookup function to ensure they are actually rendered to users.app/i18n/locales/ja.json (1)
11-14: All ABAC i18n keys in ja.json are properly used in UI components.The four translation keys are confirmed to be actively referenced:
ABAC_managedandABAC_managed_descriptionare used inRoomInfoABAC.tsxABAC_room_attributesis used inRoomInfoABAC.tsxABAC_disabled_action_reasonis used inMessageActions/index.tsxAll keys are consistently present across all locale files and match exactly between component code and locale files. No additional ABAC translation keys are missing.
app/i18n/locales/it.json (1)
15-18: Italian locale entries for ABAC support are correctly formatted and consistently integrated.The four new keys (ABAC_disabled_action_reason, ABAC_managed, ABAC_managed_description, ABAC_room_attributes) are properly added with valid JSON syntax, correctly positioned in alphabetical order between A11y and Accessibility entries. Verification confirms these keys are present across all major locale files (en, es, ja, ar, and others) and are actively used in RoomInfoABAC.tsx and MessageActions components.
app/containers/ActionSheet/Item.tsx (1)
29-29: LGTM! Clean fallback implementation.The use of
||provides a clean fallback from customdisabledReasonto the default permission message when disabled items are pressed.app/containers/ActionSheet/Provider.tsx (1)
17-17: LGTM! Type extension for custom disabled messaging.The optional
disabledReasonfield properly extends the action sheet item interface to support richer disabled-state messaging.
|
|
||
| // Forward |
There was a problem hiding this comment.
Fix ABAC array check and disabledReason type.
The current logic has two issues:
-
Type error:
room.abacAttributes && I18n.t('...')can evaluate tofalsewhenroom.abacAttributesis falsy, butdisabledReasonexpectsstring | undefined. -
Logic error: Since
abacAttributesis an array type ({ name: string; values: string[] }[]), an empty array[]is truthy in JavaScript. This means!room.abacAttributeswould befalsefor an empty array, incorrectly disabling actions even when no ABAC attributes exist.
Apply this diff to fix the array check logic in all three locations:
// Reply in DM
options.push({
title: I18n.t('Reply_in_direct_message'),
icon: 'arrow-back',
onPress: () => handleReplyInDM(message),
- enabled: permissions.hasCreateDirectMessagePermission && !room.abacAttributes,
- disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
+ enabled: permissions.hasCreateDirectMessagePermission && !room.abacAttributes?.length,
+ disabledReason: room.abacAttributes?.length ? I18n.t('ABAC_disabled_action_reason') : undefined
}); // Forward
options.push({
title: I18n.t('Forward'),
icon: 'arrow-forward',
onPress: () => handleShareMessage(message),
- enabled: !room.abacAttributes,
- disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
+ enabled: !room.abacAttributes?.length,
+ disabledReason: room.abacAttributes?.length ? I18n.t('ABAC_disabled_action_reason') : undefined
}); // Get link
options.push({
title: I18n.t('Get_link'),
icon: 'link',
onPress: () => handlePermalink(message),
- enabled: !room.abacAttributes,
- disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
+ enabled: !room.abacAttributes?.length,
+ disabledReason: room.abacAttributes?.length ? I18n.t('ABAC_disabled_action_reason') : undefined
});Also applies to: 464-465, 474-475
🤖 Prompt for AI Agents
In app/containers/MessageActions/index.tsx around lines 445-446 (and similarly
at 464-465 and 474-475): the ABAC check treats an empty array as truthy and the
disabledReason expression can yield false (not string|undefined). Replace the
current checks with explicit length checks and make disabledReason either the
translation string or undefined; e.g., compute hasAbac =
Array.isArray(room.abacAttributes) && room.abacAttributes.length > 0, use
enabled: permissions.hasCreateDirectMessagePermission && !hasAbac, and
disabledReason: hasAbac ? I18n.t('ABAC_disabled_action_reason') : undefined.
app/i18n/locales/ja.json
Outdated
| "ABAC_disabled_action_reason": "ABAC管理の部屋では利用できません", | ||
| "ABAC_managed": "ABAC管理", | ||
| "ABAC_managed_description": "準拠しているユーザーのみが属性ベースのアクセス制御された部屋にアクセスできます。属性によって部屋へのアクセスが決まります。", | ||
| "ABAC_room_attributes": "部屋の属性", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all locale files and check for ABAC keys consistency
ABAC_KEYS=("ABAC_disabled_action_reason" "ABAC_managed" "ABAC_managed_description" "ABAC_room_attributes")
# First, locate all locale JSON files
echo "=== Locale files found ==="
find app/i18n/locales -name "*.json" -type f | sort
echo ""
echo "=== Checking ABAC key presence in each locale ==="
for locale_file in $(find app/i18n/locales -name "*.json" -type f | sort); do
echo ""
echo "File: $locale_file"
missing_count=0
for key in "${ABAC_KEYS[@]}"; do
if grep -q "\"$key\"" "$locale_file"; then
echo " ✓ $key"
else
echo " ✗ $key MISSING"
((missing_count++))
fi
done
if [ $missing_count -eq 0 ]; then
echo " → All ABAC keys present"
else
echo " → $missing_count key(s) missing"
fi
doneRepository: RocketChat/Rocket.Chat.ReactNative
Length of output: 13867
Add missing ABAC translation keys to 50 locale files.
Of 72 locales, only 25 currently have the four new ABAC keys (ABAC_disabled_action_reason, ABAC_managed, ABAC_managed_description, ABAC_room_attributes). The following 50 locales are missing these keys entirely: 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. Users in these locales will encounter untranslated string keys in the UI instead of proper text.
🤖 Prompt for AI Agents
In app/i18n/locales/ja.json around lines 11 to 14, the new ABAC translation keys
are present for Japanese but 50 other locale files are missing these four keys;
add the keys "ABAC_disabled_action_reason", "ABAC_managed",
"ABAC_managed_description", and "ABAC_room_attributes" to each missing locale
file (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) using appropriate translations
or temporary English placeholders if translations are not available, ensuring
JSON valid syntax and consistent key ordering and then run lint/locale tests to
confirm no missing keys remain.
Proposed changes
room.abacAttributesIssue(s)
https://rocketchat.atlassian.net/browse/ABAC-74
How to test or reproduce
Screenshots
Sample of room info
Stories
Types of changes
Checklist
Further comments
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.