feat: Apps-Engine method to read multiple messages from a room#32176
Merged
kodiakhq[bot] merged 37 commits intodevelopfrom Jul 19, 2024
Merged
feat: Apps-Engine method to read multiple messages from a room#32176kodiakhq[bot] merged 37 commits intodevelopfrom
kodiakhq[bot] merged 37 commits intodevelopfrom
Conversation
Contributor
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 8a0e0fa The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
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 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #32176 +/- ##
========================================
Coverage 55.57% 55.58%
========================================
Files 2634 2634
Lines 57273 57279 +6
Branches 11860 11860
========================================
+ Hits 31828 31837 +9
+ Misses 22759 22751 -8
- Partials 2686 2691 +5
Flags with carried forward coverage won't be shown. Click here to find out more. |
d-gubert
requested changes
Apr 11, 2024
d-gubert
reviewed
Apr 16, 2024
d-gubert
previously approved these changes
Apr 16, 2024
debdutdeb
requested changes
Apr 16, 2024
debdutdeb
previously requested changes
Apr 17, 2024
debdutdeb
reviewed
Apr 17, 2024
Member
debdutdeb
left a comment
There was a problem hiding this comment.
I am also taking some questions back to the adr.
KevLehman
reviewed
Jun 7, 2024
KevLehman
reviewed
Jun 7, 2024
Member
Author
|
Depends on: RocketChat/Rocket.Chat.Apps-engine#770 |
KevLehman
reviewed
Jul 19, 2024
d-gubert
approved these changes
Jul 19, 2024
KevLehman
approved these changes
Jul 19, 2024
tassoevan
approved these changes
Jul 19, 2024
Merged
debdutdeb
pushed a commit
that referenced
this pull request
Jul 31, 2024
Co-authored-by: Douglas Gubert <1810309+d-gubert@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes (including videos or screenshots)
Added a new method,
getMessagesto fetch messages from a specific room. This method accepts aroomIdand anoptionsobject as parameters. Theoptionsobject can containlimit, skip, and sortproperties to control the query. The method uses theMessages.findfunction to fetch the messages from the database and converts them using a message raw converter obtained from the orch object.Since a room can have a large number of messages, this method returns a maximum of 100 messages in a single call, to read more messages one can make another call passing the
skipvalue. The default sort order is the descending order of timestamp (meaning the most recent messages will be returned), which can be overridden by passing thesortparameter.Added a new converter
convertMessageRawit removes a few fields from the following (reason: comment ):Additionally, this new method removes the
deletesince the delete operator is generally slow and can cause performance issues. It modifies the underlying object, which can lead to deoptimization in JavaScript engines.Issue(s)
Steps to test or reproduce
To test as well as reproduce the issue and solution, try running the below in the App.
Output:
(Before this PR):
(After this PR):
You can pass your own query to filter the messages you want to retrieve. The available options are:
limit: The number of messages to retrieve. (Default: 100 and Max: 100)skip: The number of messages to skip.sort: The sort order of the messages. e.g.{ ts: -1 }will sort the messages by timestamp in descending order.Further comments
Execution Stats on a room with 3M messages