Skip to content

fix: long usernames push timestamp and right icons out of view#7109

Merged
Rohit3523 merged 6 commits into
developfrom
long-username
Apr 7, 2026
Merged

fix: long usernames push timestamp and right icons out of view#7109
Rohit3523 merged 6 commits into
developfrom
long-username

Conversation

@Rohit3523

@Rohit3523 Rohit3523 commented Apr 7, 2026

Copy link
Copy Markdown
Member

Proposed changes

Fixes layout issue where long usernames push the timestamp and right-side icons out of view.

Issue(s)

https://rocketchat.atlassian.net/browse/CORE-1981

How to test or reproduce

Screenshots

- Before After
Username Screenshot 2026-04-07 at 9 02 46 PM Screenshot 2026-04-07 at 9 04 31 PM
Name Screenshot 2026-04-07 at 9 03 18 PM Screenshot 2026-04-07 at 9 04 05 PM

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

  • Tests

    • Added Storybook scenarios exercising short/medium/long display names and usernames across edited, translated, pinned, E2E/error, and read-receipt states.
  • Style

    • Improved handling and truncation of long names with adjusted spacing and icon/timestamp behavior.
  • New Features

    • Message timestamp accepts a custom text style.
    • Username header interaction target refined for more reliable presses.

@Rohit3523 Rohit3523 temporarily deployed to approve_e2e_testing April 7, 2026 15:34 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d71f986b-09e0-4151-9429-e11ee40b13cb

📥 Commits

Reviewing files that changed from the base of the PR and between 5140384 and f9cb82f.

⛔ Files ignored due to path filters (2)
  • app/containers/message/__snapshots__/Message.test.tsx.snap is excluded by !**/*.snap
  • app/views/RoomView/LoadMore/__snapshots__/LoadMore.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • app/containers/message/User.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/containers/message/User.tsx
📜 Recent review details
⏰ 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). (2)
  • GitHub Check: ESLint and Test / run-eslint-and-test
  • GitHub Check: format

Walkthrough

Added Storybook stories and long-name author fixtures for message header testing; extended MessageTime to accept an optional TextStyle prop; replaced Touch with Pressable in the message user header (adjusting press target and markup).

Changes

Cohort / File(s) Summary
Storybook stories & fixtures
app/containers/message/Message.stories.tsx
Added shortNameAuthor, mediumNameAuthor, longNameAuthor fixtures; updated longNameAuthor values used by existing stories; added Names and Usernames story exports that render multiple <Message> variants exercising name/username truncation, edited/translated/pinned/e2e/error/read-receipt states.
Message timestamp
app/containers/message/Time.tsx
Added optional style?: TextStyle to IMessageTime and accepted style in MessageTime component, appending it to the Text style array for timestamp rendering.
Message header interaction
app/containers/message/User.tsx
Replaced Touch wrapper with Pressable on the username header, moving the press interaction to Pressable and preserving testID; removed Touch import/usage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main bug fix: preventing long usernames from pushing the timestamp and icons out of view, which matches the core objective of the PR.
Linked Issues check ✅ Passed The PR changes address CORE-1981 by adding test story variants for username/display name truncation scenarios and implementing layout adjustments (style prop, Pressable component) to handle long names properly.
Out of Scope Changes check ✅ Passed All changes are scoped to the message component and its story file: new story exports for testing name truncation, added style prop to Time component for layout control, and replaced Touch with Pressable for better touch handling. These directly support the fix for long username layout issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@Rohit3523 Rohit3523 temporarily deployed to approve_e2e_testing April 7, 2026 15:40 — with GitHub Actions Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
app/containers/message/Message.stories.tsx (1)

408-419: Consider extracting repeated “icon stress-case” props in stories.

This is purely maintainability, but pulling shared props into one constant would reduce repetition and make future scenario tweaks easier.

♻️ Optional cleanup
+const iconStressProps = {
+	isEdited: true,
+	isTranslated: true,
+	pinned: true,
+	type: E2E_MESSAGE_TYPE,
+	hasError: true,
+	isReadReceiptEnabled: true,
+	read: true
+} as const;
+
 export const Names = () => (
 	<>
 		<Message msg='Small name (2 chars)' author={shortNameAuthor} useRealName />
-		<Message
-			msg='Small name with icons'
-			author={shortNameAuthor}
-			useRealName
-			isEdited
-			isTranslated
-			pinned
-			type={E2E_MESSAGE_TYPE}
-			hasError
-			isReadReceiptEnabled
-			read
-		/>
+		<Message msg='Small name with icons' author={shortNameAuthor} useRealName {...iconStressProps} />
 		...
 	</>
 );

Also applies to: 421-432, 434-445, 452-462, 464-474, 476-486

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/containers/message/Message.stories.tsx` around lines 408 - 419, Several
Storybook entries render the Message component with the same "icon stress-case"
props repeated (e.g., useRealName, isEdited, isTranslated, pinned,
type/E2E_MESSAGE_TYPE, hasError, isReadReceiptEnabled, read); extract these
shared props into a single constant (e.g., ICON_STRESS_PROPS or
commonMessageProps) and spread that constant into each Message usage to remove
duplication in Message.stories.tsx (look for Message components around the
shortNameAuthor cases and the ranges noted: 408-419, 421-432, 434-445, 452-462,
464-474, 476-486).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/containers/message/User.tsx`:
- Around line 123-129: The username Text used as a press target (in the User
component) lacks accessibility semantics; update the Text element (the one with
props numberOfLines, ellipsizeMode, onPress and testID
`username-header-${username}`) to expose button semantics—either add
accessibilityRole="button" and accessible={true} plus a descriptive
accessibilityLabel (e.g., include username) and accessibilityHint where
appropriate, or replace it with a Pressable wrapper that forwards onPress and
testID and sets accessibilityRole="button" and accessible={true}; ensure the
onUserPress handler and displayed textContent remain unchanged.

---

Nitpick comments:
In `@app/containers/message/Message.stories.tsx`:
- Around line 408-419: Several Storybook entries render the Message component
with the same "icon stress-case" props repeated (e.g., useRealName, isEdited,
isTranslated, pinned, type/E2E_MESSAGE_TYPE, hasError, isReadReceiptEnabled,
read); extract these shared props into a single constant (e.g.,
ICON_STRESS_PROPS or commonMessageProps) and spread that constant into each
Message usage to remove duplication in Message.stories.tsx (look for Message
components around the shortNameAuthor cases and the ranges noted: 408-419,
421-432, 434-445, 452-462, 464-474, 476-486).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fa9527c7-4e3c-4e6e-af3c-e71909affa20

📥 Commits

Reviewing files that changed from the base of the PR and between d03eb78 and 5140384.

📒 Files selected for processing (3)
  • app/containers/message/Message.stories.tsx
  • app/containers/message/Time.tsx
  • app/containers/message/User.tsx
📜 Review details
⏰ 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). (3)
  • GitHub Check: E2E Build iOS / ios-build
  • GitHub Check: E2E Build Android / android-build
  • GitHub Check: ESLint and Test / run-eslint-and-test
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Rohit3523
Repo: RocketChat/Rocket.Chat.ReactNative PR: 6808
File: app/containers/MessageComposer/components/ComposerInput.tsx:337-341
Timestamp: 2026-04-04T21:34:27.535Z
Learning: In Rocket.Chat React Native, the markdown composer's autocomplete insertion (ComposerInput.tsx onAutocompleteItemSelected) does NOT need to add a space between an underscore italic delimiter `_` and a `@` or `#` mention sigil. The web platform (using the same rocket.chat/message-parser) does not add such a space either, so parity with web is the correct behavior. The previous learning about "space between `_` and mention sigil" applies only to test/story file content strings, not to the composer's runtime autocomplete behavior.
📚 Learning: 2026-03-15T13:55:42.038Z
Learnt from: Rohit3523
Repo: RocketChat/Rocket.Chat.ReactNative PR: 6911
File: app/containers/markdown/Markdown.stories.tsx:104-104
Timestamp: 2026-03-15T13:55:42.038Z
Learning: In Rocket.Chat React Native, the markdown parser requires a space between the underscore wrapping italic text and a mention sigil (_ mention _ instead of _mention_). Ensure stories and tests that include italic-wrapped mentions follow this form to guarantee proper parsing. Specifically, for files like app/containers/markdown/Markdown.stories.tsx, and any test/content strings that exercise italic-mentions, use the pattern _ mention _ (with spaces) to prevent the mention from being treated as plain text. Validate any test strings or story content accordingly.

Applied to files:

  • app/containers/message/Message.stories.tsx
🔇 Additional comments (3)
app/containers/message/Time.tsx (1)

11-21: Good extension point for message header layout.

Adding optional style and composing it last in the Text style array is a clean, low-risk way to support caller-side spacing tweaks.

app/containers/message/User.tsx (1)

36-47: Layout fix is solid for truncation + timestamp/icon preservation.

titleContainer with flex: 1 + minWidth: 0, username numberOfLines={1}, and explicit MessageTime spacing achieves the intended header behavior.

Also applies to: 122-132

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

31-47: Great story coverage for the reported regression.

The new short/medium/long fixtures plus Names and Usernames scenarios are well-targeted to validate truncation with timestamp and right-side icon combinations.

Also applies to: 405-488

Comment thread app/containers/message/User.tsx Outdated
@Rohit3523 Rohit3523 had a problem deploying to official_android_build April 7, 2026 15:43 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build April 7, 2026 15:43 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build April 7, 2026 15:43 — with GitHub Actions Error
Comment thread app/containers/message/User.tsx Outdated
Comment thread app/containers/message/User.tsx Outdated
@Rohit3523 Rohit3523 temporarily deployed to approve_e2e_testing April 7, 2026 16:25 — with GitHub Actions Inactive
@Rohit3523 Rohit3523 had a problem deploying to official_android_build April 7, 2026 16:30 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build April 7, 2026 16:30 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build April 7, 2026 16:30 — with GitHub Actions Error

@OtavioStasiak OtavioStasiak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

@Rohit3523 Rohit3523 had a problem deploying to approve_e2e_testing April 7, 2026 19:11 — with GitHub Actions Failure
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build April 7, 2026 19:14 — with GitHub Actions Failure
@Rohit3523 Rohit3523 had a problem deploying to official_android_build April 7, 2026 19:14 — with GitHub Actions Failure
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build April 7, 2026 19:14 — with GitHub Actions Failure
@Rohit3523 Rohit3523 had a problem deploying to official_ios_build April 7, 2026 19:14 — with GitHub Actions Failure
@Rohit3523 Rohit3523 merged commit 37f4949 into develop Apr 7, 2026
5 of 11 checks passed
@Rohit3523 Rohit3523 deleted the long-username branch April 7, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants