Skip to content

fix: boolean conversion confusion trigger handler#38715

Open
mdawoud27 wants to merge 1 commit intoRocketChat:developfrom
mdawoud27:fix/boolean-conversion-confusion-trigger-handler
Open

fix: boolean conversion confusion trigger handler#38715
mdawoud27 wants to merge 1 commit intoRocketChat:developfrom
mdawoud27:fix/boolean-conversion-confusion-trigger-handler

Conversation

@mdawoud27
Copy link

@mdawoud27 mdawoud27 commented Feb 15, 2026

Proposed changes (including videos or screenshots)

Replaced Boolean(message.bot) with true in two locations:

if (message.bot) {
-    data.bot = Boolean(message.bot); // TODO: need to double check this, since it makes no sense
+    data.bot = true;
 }

Why This Improvement?

  • The message.bot field is an object, so Boolean(message.bot) is always true if the object exists.
  • Explicitly setting true is clearer than a type conversion when existence is already checked.

Issue(s)

Close #38713

Summary by CodeRabbit

  • Bug Fixes
    • Fixed bot message identification in event processing to correctly recognize bot-originated messages and file uploads.

@mdawoud27 mdawoud27 requested a review from a team as a code owner February 15, 2026 18:46
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 15, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2026

⚠️ No Changeset found

Latest commit: e327bf3

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
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Walkthrough

The triggerHandler.ts file is updated to remove confusing Boolean conversion of the message.bot field. Since bot is typed as an object, Boolean(message.bot) always returns true when the object exists. The change replaces this with explicit true assignment in two locations.

Changes

Cohort / File(s) Summary
Trigger Handler Bot Field
apps/meteor/app/integrations/server/lib/triggerHandler.ts
Replaced Boolean(message.bot) with explicit true assignment in both 'sendMessage' and 'fileUploaded' branches of mapEventArgsToData function for clarity.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through trigger code,
Where bots once caused confusion's load,
Now true shines clear, no casting schemes,
Just honest logic, pure as dreams! ✨

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—fixing a confusing boolean conversion in the trigger handler by replacing Boolean() coercion with explicit true assignment.
Linked Issues check ✅ Passed The PR implementation directly addresses issue #38713 by replacing Boolean(message.bot) with true in both occurrences, exactly as proposed in the linked issue.
Out of Scope Changes check ✅ Passed The PR contains only targeted changes to the triggerHandler.ts file that directly address the confusing boolean conversion issue, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop

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


No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11e1c51 and e327bf3.

📒 Files selected for processing (1)
  • apps/meteor/app/integrations/server/lib/triggerHandler.ts
🧰 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/integrations/server/lib/triggerHandler.ts
🧠 Learnings (1)
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/integrations/server/lib/triggerHandler.ts
⏰ 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: cubic · AI code reviewer
🔇 Additional comments (1)
apps/meteor/app/integrations/server/lib/triggerHandler.ts (1)

288-290: LGTM — clearer intent with no behavioral change.

Since message.bot is typed as Record<string, any> | undefined, the guard already guarantees truthiness; replacing Boolean(message.bot) with the literal true removes the redundant coercion and better communicates the intent.

Also applies to: 316-318

✏️ Tip: You can disable this entire section by setting review_details to false in your review 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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

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.

Fix: Boolean conversion confusion trigger handler

1 participant