Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(messages): Allow Custom Fields in Messages #32224

Merged
merged 19 commits into from
Apr 19, 2024

Conversation

rodrigok
Copy link
Member

@rodrigok rodrigok commented Apr 16, 2024

Proposed changes (including videos or screenshots)

Add two new settings to control the custom fields in the messages' object:

  • Message_CustomFields_Enabled: Boolean, default false
  • Message_CustomFields: String/Code/JSON, an AJV schema validator

It allows a new property named customFields to be sent via message APIs. When enabled it will be validated based on the AJV schema defined.

The backend will force the schema type to "object" and prevent extra properties by forcing "additionalProperties" as false.

Issue(s)

CORE-274

Steps to test or reproduce

cURL for testing

curl --location 'http://localhost:3000/api/v1/chat.sendMessage' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: ***' \
--header 'X-User-Id: ***' \
--data '{"message": {"rid":"GENERAL","msg":"Sample","customFields":{"priority": "high"}}}'

Further comments

TODO

  • Tests
  • Changeset
  • Docs
  • Task

Copy link
Contributor

dionisio-bot bot commented Apr 16, 2024

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

Copy link

changeset-bot bot commented Apr 16, 2024

🦋 Changeset detected

Latest commit: f4b2297

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 34 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/core-typings Minor
@rocket.chat/i18n Minor
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/gazzodown Major
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/rest-typings Minor
@rocket.chat/ui-contexts Major
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/api-client Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/mock-providers Patch
@rocket.chat/web-ui-registration Major
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/models Patch
@rocket.chat/ddp-client Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-video-conf Major
@rocket.chat/uikit-playground Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

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

@rodrigok rodrigok added this to the 6.8 milestone Apr 16, 2024
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.35%. Comparing base (d134a4d) to head (f4b2297).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #32224      +/-   ##
===========================================
+ Coverage    55.31%   55.35%   +0.03%     
===========================================
  Files         2319     2323       +4     
  Lines        51201    51255      +54     
  Branches     10473    10485      +12     
===========================================
+ Hits         28323    28370      +47     
+ Misses       20367    20366       -1     
- Partials      2511     2519       +8     
Flag Coverage Δ
e2e 54.77% <ø> (+0.03%) ⬆️
unit 74.83% <100.00%> (+0.03%) ⬆️

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

@rodrigok rodrigok force-pushed the feat/message-custom-fields branch 3 times, most recently from f519ca8 to 4e04dee Compare April 16, 2024 22:17
@rodrigok rodrigok marked this pull request as ready for review April 17, 2024 14:09
@rodrigok rodrigok requested review from a team as code owners April 17, 2024 14:09
Copy link
Member

@MarcosSpessatto MarcosSpessatto left a comment

Choose a reason for hiding this comment

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

Let's add this new optional parameter here as well: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rest-typings/src/v1/chat.ts#L15

Also, should we add that feature on message editing too?

@jessicaschelly jessicaschelly added the stat: QA assured Means it has been tested and approved by a company insider label Apr 19, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 19, 2024
@kodiakhq kodiakhq bot merged commit c47a8e3 into develop Apr 19, 2024
43 checks passed
@kodiakhq kodiakhq bot deleted the feat/message-custom-fields branch April 19, 2024 19:44
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants