-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMPROVE] Add user to room on "Click to Join!" button press (#24041)
* Display Join button in discussions inside channels, add user to room on 'Click To Join' * Open jitsi call on Meteor.call callback * Fixed jitsi * Removed console.log * Add user to room when clicking on the 'Call' tbb bar option * Update getMessageFunction name * Use canAccessRoomId function Co-authored-by: Tasso Evangelista <tasso.evangelista@rocket.chat> Co-authored-by: Pierre Lehnen <pierre.lehnen@rocket.chat> Co-authored-by: Leonardo Ostjen Couto <leonardoostjen@gmail.com>
- Loading branch information
1 parent
4fdd558
commit 993c6fb
Showing
8 changed files
with
83 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { IUser } from '../../../definition/IUser'; | ||
import type { IMessage } from '../../../definition/IMessage/IMessage'; | ||
import { Messages } from '../../../app/models/server/raw'; | ||
import { canAccessRoomId } from '../../../app/authorization/server'; | ||
|
||
export async function getMessageForUser(messageId: IMessage['_id'], uid: IUser['_id']): Promise<IMessage | undefined> { | ||
if (!uid) { | ||
throw new Error('error-invalid-user'); | ||
} | ||
|
||
const message = await Messages.findOne(messageId); | ||
if (!message) { | ||
return; | ||
} | ||
|
||
if (!canAccessRoomId(message.rid, uid)) { | ||
throw new Error('error-not-allowed'); | ||
} | ||
|
||
return message; | ||
} |