Skip to content

regression: Prevent inherited properties from being treated as emoji shortcodes - #41523

Merged
dionisio-bot[bot] merged 3 commits into
release-8.7.0from
reg/prototype-shortcodes
Jul 23, 2026
Merged

regression: Prevent inherited properties from being treated as emoji shortcodes#41523
dionisio-bot[bot] merged 3 commits into
release-8.7.0from
reg/prototype-shortcodes

Conversation

@yash-rajpal

@yash-rajpal yash-rajpal commented Jul 22, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Fixes by adding a guard for the lookup with Object.hasOwn so only own keys are matched and doesn't match with Object.prototype.

Issue(s)

Steps to test or reproduce

  • Open a channel
  • Go to Channel info → Edit
  • Set Announcement to - :toString:
  • Save

Check the Announcement

Further comments

CORE-2451

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Fixed emoji shortcode rendering for names that could conflict with built-in object properties, such as :toString:.
    • Preserved correct conversion of recognized legacy emoji shortcodes into emoji characters.
  • Tests

    • Added coverage confirming valid shortcodes render as emojis while prototype-like names remain unchanged.

@dionisio-bot

dionisio-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b03cbdb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 32bef4d0-39b5-4079-92aa-407d3178d54a

📥 Commits

Reviewing files that changed from the base of the PR and between ce251e1 and b03cbdb.

📒 Files selected for processing (2)
  • apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts
  • apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (4)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ✅ **QA assured**
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ✅ **QA assured**
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ✅ **QA assured**
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ✅ **QA assured**
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts
  • apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts
🧠 Learnings (4)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts
  • apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts
  • apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts
  • apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts
📚 Learning: 2026-07-22T19:03:06.706Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 41520
File: apps/meteor/app/emoji-native/lib/getEmojiConfig.ts:59-62
Timestamp: 2026-07-22T19:03:06.706Z
Learning: In Rocket.Chat’s native emoji pipeline, keep the legacy-parity behavior for ASCII emoticons that appear inside `<code>`/`<pre>`: `apps/meteor/app/emoji-native/lib/getEmojiConfig.ts` may convert matching ASCII emoticons into emoji-span nodes, but the downstream DOM pass in `apps/meteor/app/emoji/client/emojiParser.ts` must restore the emoji span’s literal `title` text when the span’s parent is a `CODE` element. When changing emoji config or parsing, ensure this `<code>` protection behavior is preserved; the planned structural HTML protection should be handled by the post-release message-parser/gazzodown migration rather than by removing/altering this restore logic ad-hoc.

Applied to files:

  • apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts
  • apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts
🔇 Additional comments (2)
apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts (1)

5-5: LGTM!

Also applies to: 1428-1429

apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts (1)

14-14: LGTM!


Walkthrough

Legacy emoji shortcode lookup now uses a prototype-less mapping, allowing direct fallback access without resolving inherited properties. Parser tests cover known shortcode rendering and preservation of prototype-like shortcodes.

Changes

Emoji shortcode rendering

Layer / File(s) Summary
Guard legacy lookup and test rendering
apps/meteor/app/emoji-native/lib/legacyEmojioneMap.ts, apps/meteor/app/emoji-native/lib/shortnameToUnicode.ts, apps/meteor/tests/unit/app/emoji/emojiNativeParser.spec.ts
The legacy map is created without a prototype, fallback lookup reads it directly, and rendering tests cover both known and prototype-like shortcodes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: type: bug

Suggested reviewers: martinschoeler, cardoso

🚥 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 accurately captures the main regression fix: inherited prototype properties no longer resolve as emoji shortcodes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2451: Request failed with status code 401

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.

@yash-rajpal
yash-rajpal marked this pull request as ready for review July 22, 2026 19:50
@yash-rajpal
yash-rajpal requested a review from a team as a code owner July 22, 2026 19:50
@yash-rajpal yash-rajpal added the stat: QA assured Means it has been tested and approved by a company insider label Jul 22, 2026
@yash-rajpal yash-rajpal added this to the 8.7.0 milestone Jul 22, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 22, 2026

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 2 files

Re-trigger cubic

Comment thread apps/meteor/app/emoji-native/lib/getEmojiConfig.ts
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-8.7.0@4c6cdfe). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##             release-8.7.0   #41523   +/-   ##
================================================
  Coverage                 ?   68.57%           
================================================
  Files                    ?     4138           
  Lines                    ?   159352           
  Branches                 ?    27970           
================================================
  Hits                     ?   109272           
  Misses                   ?    44942           
  Partials                 ?     5138           
Flag Coverage Δ
unit 70.56% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yash-rajpal
yash-rajpal requested review from cardoso and ggazzo July 23, 2026 15:21

@cardoso cardoso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All good 👍

Image

@dionisio-bot
dionisio-bot Bot merged commit d81ca08 into release-8.7.0 Jul 23, 2026
28 checks passed
@dionisio-bot
dionisio-bot Bot deleted the reg/prototype-shortcodes branch July 23, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants