Prevent calls from users who aren't contacts
This commit is contained in:
parent
bec6b41448
commit
da6106db8e
1 changed files with 13 additions and 0 deletions
|
@ -654,7 +654,20 @@ impl Server {
|
|||
request: TypedEnvelope<proto::Call>,
|
||||
response: Response<proto::Call>,
|
||||
) -> Result<()> {
|
||||
let caller_user_id = self
|
||||
.store()
|
||||
.await
|
||||
.user_id_for_connection(request.sender_id)?;
|
||||
let recipient_user_id = UserId::from_proto(request.payload.recipient_user_id);
|
||||
if !self
|
||||
.app_state
|
||||
.db
|
||||
.has_contact(caller_user_id, recipient_user_id)
|
||||
.await?
|
||||
{
|
||||
return Err(anyhow!("cannot call a user who isn't a contact"))?;
|
||||
}
|
||||
|
||||
let room_id = request.payload.room_id;
|
||||
let mut calls = {
|
||||
let mut store = self.store().await;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue