-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[BREAK] Move read-receipts to EE and threads check marks improvements #27074
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
Merged
Merged
Changes from 27 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
09b52a4
first commit
sampaiodiego 2cab6e0
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 8dda41f
Add Reads model
matheusbsilva137 4df0834
Add readThread method
matheusbsilva137 9cd1a3f
Merge remote-tracking branch 'origin/develop' into fix-threads-read-r…
sampaiodiego a8bf703
fix first thread message as read
sampaiodiego 7838e80
Mark messages as read only when everyone in the room reads it
matheusbsilva137 8c8a080
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 8f9b674
Fix typecheck error
matheusbsilva137 62b866c
Move read receipts to EE
matheusbsilva137 d4fd644
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 9fdaeaa
Fix getReadReceipts method in EE
matheusbsilva137 4b96159
Remove logs
matheusbsilva137 11ecc8c
Add EE license check
matheusbsilva137 030fd7c
Apply requested changes
matheusbsilva137 cf6ec1d
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 1bf8ba0
Update read receipts on readThreads call
matheusbsilva137 169f205
Add new strategy to change thread messages to read in large rooms
matheusbsilva137 6a30123
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 eb702c4
Remove startup import
matheusbsilva137 cdfdde2
Fix typecheck error
matheusbsilva137 a31375a
Remove chat.getMessageReadReceipts endpoint tests (TODO - add in a ne…
matheusbsilva137 1aaefcf
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 2dc9d6f
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 7a5c543
Merge branch 'develop' into fix-threads-read-receipts
sampaiodiego 51ac07f
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 7e6538a
Make read receipts settings visible to community
matheusbsilva137 44aba3b
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 c8d2d3c
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 cd50655
Force update cached collection on version upgrade (so as to get the c…
matheusbsilva137 461d877
Filter unarchived subscriptions on DB query
matheusbsilva137 3d3ca04
Add ls index in Reads model
matheusbsilva137 d22b410
Merge branch 'develop' into fix-threads-read-receipts
LucianoPierdona a9cd2ce
add tests to EE
LucianoPierdona f576c08
update tests
LucianoPierdona 848bea8
Add ReadsService to core-services package
matheusbsilva137 dca7967
update test description
LucianoPierdona 40ed6ba
Skip tests when workspace is not EE
matheusbsilva137 4fd6ec5
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 bc007ef
Run beforeReadMessages callback after checks
matheusbsilva137 f39d800
Remove try/catch from chat.getMessageReadReceipts endpoint
matheusbsilva137 e8b2637
Update service and collection names to MessageReads
matheusbsilva137 0e19cc8
Revert IRoom type change
matheusbsilva137 a9c9cc0
Update condition to check if room is from omnichannel
matheusbsilva137 c4e17fc
Merge branch 'develop' into fix-threads-read-receipts
ggazzo 8bb89d2
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 71ba401
Merge branch 'develop' into fix-threads-read-receipts
kodiakhq[bot] eeb370c
Merge branch 'develop' into fix-threads-read-receipts
kodiakhq[bot] 66c8621
Merge branch 'develop' into fix-threads-read-receipts
kodiakhq[bot] 326abe9
Merge branch 'develop' into fix-threads-read-receipts
kodiakhq[bot] 9460eb1
Merge branch 'develop' into fix-threads-read-receipts
kodiakhq[bot] 2418212
Merge branch 'develop' into fix-threads-read-receipts
sampaiodiego 2646403
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 5dc4c05
Merge branch 'develop' into fix-threads-read-receipts
matheusbsilva137 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
24 changes: 24 additions & 0 deletions
24
apps/meteor/ee/app/message-read-receipt/server/hooks/afterReadMessages.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import type { IUser, IRoom, IMessage } from '@rocket.chat/core-typings'; | ||
|
|
||
| import { Reads } from '../../../../server/sdk'; | ||
|
matheusbsilva137 marked this conversation as resolved.
Outdated
|
||
| import { ReadReceipt } from '../../../../server/lib/message-read-receipt/ReadReceipt'; | ||
| import { callbacks } from '../../../../../lib/callbacks'; | ||
| import { settings } from '../../../../../app/settings/server'; | ||
|
|
||
| callbacks.add( | ||
| 'afterReadMessages', | ||
| (rid: IRoom['_id'], params: { uid: IUser['_id']; lastSeen?: Date; tmid?: IMessage['_id'] }) => { | ||
| if (!settings.get('Message_Read_Receipt_Enabled')) { | ||
| return; | ||
| } | ||
| const { uid, lastSeen, tmid } = params; | ||
|
|
||
| if (tmid) { | ||
| Reads.readThread(uid, tmid); | ||
| } else if (lastSeen) { | ||
| ReadReceipt.markMessagesAsRead(rid, uid, lastSeen); | ||
| } | ||
| }, | ||
| callbacks.priority.MEDIUM, | ||
| 'message-read-receipt-afterReadMessages', | ||
| ); | ||
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
2 changes: 2 additions & 0 deletions
2
apps/meteor/ee/app/message-read-receipt/server/hooks/index.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import './afterReadMessages'; | ||
| import './afterSaveMessage'; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { onLicense } from '../../license/server'; | ||
|
|
||
| onLicense('message-read-receipt', () => { | ||
| require('./hooks'); | ||
|
matheusbsilva137 marked this conversation as resolved.
Outdated
|
||
| }); | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { Meteor } from 'meteor/meteor'; | ||
| import { Tracker } from 'meteor/tracker'; | ||
|
|
||
| import { settings } from '../../../app/settings/client'; | ||
| import { MessageAction } from '../../../app/ui-utils/client'; | ||
| import { imperativeModal } from '../../../client/lib/imperativeModal'; | ||
| import { messageArgs } from '../../../client/lib/utils/messageArgs'; | ||
| import ReadReceiptsModal from '../../../client/views/room/modals/ReadReceiptsModal'; | ||
|
|
||
| Meteor.startup(() => { | ||
| Tracker.autorun(() => { | ||
| const enabled = settings.get('Message_Read_Receipt_Store_Users'); | ||
|
|
||
| if (!enabled) { | ||
| return MessageAction.removeButton('receipt-detail'); | ||
| } | ||
|
|
||
| MessageAction.addButton({ | ||
| id: 'receipt-detail', | ||
| icon: 'info-circled', | ||
| label: 'Info', | ||
| context: ['starred', 'message', 'message-mobile', 'threads'], | ||
| action(_, props) { | ||
| const { message = messageArgs(this).msg } = props; | ||
| imperativeModal.open({ | ||
| component: ReadReceiptsModal, | ||
| props: { messageId: message._id, onClose: imperativeModal.close }, | ||
| }); | ||
| }, | ||
| order: 10, | ||
| group: 'menu', | ||
| }); | ||
| }); | ||
| }); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { IMessage, ReadReceipt } from '@rocket.chat/core-typings'; | ||
| import Ajv from 'ajv'; | ||
|
|
||
| const ajv = new Ajv({ | ||
| coerceTypes: true, | ||
| }); | ||
|
|
||
| type GetMessageReadReceiptsProps = { | ||
| messageId: IMessage['_id']; | ||
| }; | ||
|
|
||
| const getMessageReadReceiptsPropsSchema = { | ||
| type: 'object', | ||
| properties: { | ||
| messageId: { | ||
| type: 'string', | ||
| }, | ||
| }, | ||
| required: ['messageId'], | ||
| additionalProperties: false, | ||
| }; | ||
|
|
||
| export const isGetMessageReadReceiptsProps = ajv.compile<GetMessageReadReceiptsProps>(getMessageReadReceiptsPropsSchema); | ||
|
|
||
| declare module '@rocket.chat/rest-typings' { | ||
| // eslint-disable-next-line @typescript-eslint/naming-convention | ||
| interface Endpoints { | ||
| '/v1/chat.getMessageReadReceipts': { | ||
| GET: (params: GetMessageReadReceiptsProps) => { | ||
| receipts: ReadReceipt[]; | ||
| }; | ||
| }; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { Meteor } from 'meteor/meteor'; | ||
|
|
||
| import { API } from '../../../app/api/server/api'; | ||
| import { hasLicense } from '../../app/license/server/license'; | ||
|
|
||
| API.v1.addRoute( | ||
| 'chat.getMessageReadReceipts', | ||
| { authRequired: true }, | ||
| { | ||
| async get() { | ||
| if (!hasLicense('message-read-receipt')) { | ||
| throw new Meteor.Error('error-action-not-allowed', 'This is an enterprise feature'); | ||
| } | ||
|
|
||
| const { messageId } = this.queryParams; | ||
| if (!messageId) { | ||
| return API.v1.failure({ | ||
| error: "The required 'messageId' param is missing.", | ||
| }); | ||
| } | ||
|
|
||
| try { | ||
| return API.v1.success({ | ||
| receipts: await Meteor.call('getReadReceipts', { messageId }), | ||
| }); | ||
| } catch (error: any) { | ||
| return API.v1.failure({ | ||
| error: error.message, | ||
| }); | ||
| } | ||
|
matheusbsilva137 marked this conversation as resolved.
Outdated
|
||
| }, | ||
| }, | ||
| ); | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.