-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/attachment-file
- Loading branch information
Showing
87 changed files
with
1,845 additions
and
483 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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
29 changes: 29 additions & 0 deletions
29
apps/meteor/app/e2e/server/functions/handleSuggestedGroupKey.ts
This file contains 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,29 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Subscriptions } from '@rocket.chat/models'; | ||
|
||
export async function handleSuggestedGroupKey( | ||
handle: 'accept' | 'reject', | ||
rid: string, | ||
userId: string | null, | ||
method: string, | ||
): Promise<void> { | ||
if (!userId) { | ||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method }); | ||
} | ||
|
||
const sub = await Subscriptions.findOneByRoomIdAndUserId(rid, userId); | ||
if (!sub) { | ||
throw new Meteor.Error('error-subscription-not-found', 'Subscription not found', { method }); | ||
} | ||
|
||
const suggestedKey = String(sub.E2ESuggestedKey ?? '').trim(); | ||
if (!suggestedKey) { | ||
throw new Meteor.Error('error-no-suggested-key-available', 'No suggested key available', { method }); | ||
} | ||
|
||
if (handle === 'accept') { | ||
await Subscriptions.setGroupE2EKey(sub._id, suggestedKey); | ||
} | ||
|
||
await Subscriptions.unsetGroupE2ESuggestedKey(sub._id); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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,27 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Subscriptions } from '@rocket.chat/models'; | ||
|
||
Meteor.methods({ | ||
async 'e2e.updateGroupKey'(rid, uid, key) { | ||
const userId = Meteor.userId(); | ||
if (!userId) { | ||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'e2e.acceptSuggestedGroupKey' }); | ||
} | ||
|
||
// I have a subscription to this room | ||
const mySub = await Subscriptions.findOneByRoomIdAndUserId(rid, userId); | ||
|
||
if (mySub) { | ||
// Setting the key to myself, can set directly to the final field | ||
if (userId === uid) { | ||
return Subscriptions.setGroupE2EKey(mySub._id, key); | ||
} | ||
|
||
// uid also has subscription to this room | ||
const userSub = await Subscriptions.findOneByRoomIdAndUserId(rid, uid); | ||
if (userSub) { | ||
return Subscriptions.setGroupE2ESuggestedKey(userSub._id, key); | ||
} | ||
} | ||
}, | ||
}); |
This file contains 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 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
Oops, something went wrong.