forked from jmug/stoatchat
feat: allow users to specify who is notified when starting a call
This commit is contained in:
@@ -124,9 +124,7 @@ pub async fn get_user_voice_channel_in_server(
|
||||
|
||||
let unique_key = format!("{user_id}:{server_id}");
|
||||
|
||||
conn.get(&unique_key)
|
||||
.await
|
||||
.to_internal_error()
|
||||
conn.get(&unique_key).await.to_internal_error()
|
||||
}
|
||||
|
||||
pub fn get_allowed_sources(
|
||||
@@ -479,3 +477,32 @@ pub async fn take_channel_call_started_system_message(channel_id: &str) -> Resul
|
||||
.await
|
||||
.to_internal_error()
|
||||
}
|
||||
|
||||
pub async fn set_call_notification_recipients(
|
||||
channel_id: &str,
|
||||
user_id: &str,
|
||||
recipients: &[String],
|
||||
) -> Result<()> {
|
||||
get_connection()
|
||||
.await?
|
||||
.set_ex(
|
||||
format!("call_notification_recipients:{channel_id}-{user_id}"),
|
||||
recipients,
|
||||
10,
|
||||
)
|
||||
.await
|
||||
.to_internal_error()
|
||||
}
|
||||
|
||||
pub async fn get_call_notification_recipients(
|
||||
channel_id: &str,
|
||||
user_id: &str,
|
||||
) -> Result<Option<Vec<String>>> {
|
||||
get_connection()
|
||||
.await?
|
||||
.get_del(format!(
|
||||
"call_notification_recipients:{channel_id}-{user_id}"
|
||||
))
|
||||
.await
|
||||
.to_internal_error()
|
||||
}
|
||||
|
||||
@@ -294,10 +294,14 @@ auto_derived!(
|
||||
pub struct DataJoinCall {
|
||||
/// Name of the node to join
|
||||
pub node: Option<String>,
|
||||
/// Whether to force disconnect any other existing voice connections.
|
||||
/// Whether to force disconnect any other existing voice connections
|
||||
///
|
||||
/// useful for disconnecting on another device and joining on a new.
|
||||
/// Useful for disconnecting on another device and joining on a new.
|
||||
pub force_disconnect: Option<bool>,
|
||||
/// Users which should be notified of the call starting
|
||||
///
|
||||
/// Only used when the user is the first one connected.
|
||||
pub recipients: Option<Vec<String>>,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user