1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00
conduit/src/api/client_server/push.rs

584 lines
19 KiB
Rust
Raw Normal View History

2022-10-05 20:34:31 +02:00
use crate::{services, Error, Result, Ruma};
2020-07-30 18:14:47 +02:00
use ruma::{
api::client::{
error::ErrorKind,
2022-02-18 15:33:14 +01:00
push::{
2021-01-24 16:05:52 +01:00
delete_pushrule, get_pushers, get_pushrule, get_pushrule_actions, get_pushrule_enabled,
2021-01-26 21:53:03 -05:00
get_pushrules_all, set_pusher, set_pushrule, set_pushrule_actions,
set_pushrule_enabled, RuleKind,
2021-01-24 16:05:52 +01:00
},
2020-07-30 18:14:47 +02:00
},
2022-04-07 13:22:10 +02:00
events::{push_rules::PushRulesEvent, GlobalAccountDataEventType},
push::{ConditionalPushRuleInit, PatternedPushRuleInit, SimplePushRuleInit},
2020-07-30 18:14:47 +02:00
};
2021-08-31 19:14:37 +02:00
/// # `GET /_matrix/client/r0/pushrules`
///
/// Retrieves the push rules event for this user.
pub async fn get_pushrules_all_route(
2022-02-18 15:33:14 +01:00
body: Ruma<get_pushrules_all::v3::Request>,
) -> Result<get_pushrules_all::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
2020-07-30 18:14:47 +02:00
2022-10-05 15:33:57 +02:00
let event = services()
2020-07-30 18:14:47 +02:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2020-07-30 18:14:47 +02:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?
.content;
2022-02-18 15:33:14 +01:00
Ok(get_pushrules_all::v3::Response {
2022-10-05 15:33:57 +02:00
global: account_data.global,
})
2020-07-30 18:14:47 +02:00
}
2021-08-31 19:14:37 +02:00
/// # `GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}`
///
/// Retrieves a single specified push rule for this user.
2021-01-24 16:05:52 +01:00
pub async fn get_pushrule_route(
2022-04-06 21:31:29 +02:00
body: Ruma<get_pushrule::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<get_pushrule::v3::Response> {
2021-01-24 16:05:52 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?
.content;
let global = account_data.global;
2021-01-24 16:05:52 +01:00
let rule = match body.kind {
RuleKind::Override => global
.override_
.get(body.rule_id.as_str())
.map(|rule| rule.clone().into()),
2021-01-24 16:05:52 +01:00
RuleKind::Underride => global
.underride
.get(body.rule_id.as_str())
.map(|rule| rule.clone().into()),
2021-01-24 16:05:52 +01:00
RuleKind::Sender => global
.sender
.get(body.rule_id.as_str())
.map(|rule| rule.clone().into()),
2021-01-24 16:05:52 +01:00
RuleKind::Room => global
.room
.get(body.rule_id.as_str())
.map(|rule| rule.clone().into()),
2021-01-24 16:05:52 +01:00
RuleKind::Content => global
.content
.get(body.rule_id.as_str())
.map(|rule| rule.clone().into()),
2021-07-15 19:54:04 +02:00
_ => None,
2021-01-24 16:05:52 +01:00
};
if let Some(rule) = rule {
2022-02-18 15:33:14 +01:00
Ok(get_pushrule::v3::Response { rule })
2021-01-24 16:05:52 +01:00
} else {
Err(Error::BadRequest(
ErrorKind::NotFound,
"Push rule not found.",
))
2021-01-24 16:05:52 +01:00
}
}
2021-08-31 19:14:37 +02:00
/// # `PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}`
///
/// Creates a single specified push rule for this user.
pub async fn set_pushrule_route(
2022-04-06 21:31:29 +02:00
body: Ruma<set_pushrule::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<set_pushrule::v3::Response> {
2021-12-15 13:58:25 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let body = body.body;
2021-01-24 16:05:52 +01:00
if body.scope != "global" {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let mut account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?;
let global = &mut account_data.content.global;
2021-01-24 16:05:52 +01:00
match body.kind {
RuleKind::Override => {
global.override_.replace(
2021-01-24 16:05:52 +01:00
ConditionalPushRuleInit {
actions: body.actions,
2021-01-24 16:05:52 +01:00
default: false,
enabled: true,
rule_id: body.rule_id,
conditions: body.conditions,
2021-01-24 16:05:52 +01:00
}
.into(),
);
2021-01-24 16:05:52 +01:00
}
RuleKind::Underride => {
global.underride.replace(
2021-01-24 16:05:52 +01:00
ConditionalPushRuleInit {
actions: body.actions,
2021-01-24 16:05:52 +01:00
default: false,
enabled: true,
rule_id: body.rule_id,
conditions: body.conditions,
2021-01-24 16:05:52 +01:00
}
.into(),
);
2021-01-24 16:05:52 +01:00
}
RuleKind::Sender => {
global.sender.replace(
2021-01-24 16:05:52 +01:00
SimplePushRuleInit {
actions: body.actions,
2021-01-24 16:05:52 +01:00
default: false,
enabled: true,
rule_id: body.rule_id,
2021-01-24 16:05:52 +01:00
}
.into(),
);
2021-01-24 16:05:52 +01:00
}
RuleKind::Room => {
global.room.replace(
2021-01-24 16:05:52 +01:00
SimplePushRuleInit {
actions: body.actions,
2021-01-24 16:05:52 +01:00
default: false,
enabled: true,
rule_id: body.rule_id,
2021-01-24 16:05:52 +01:00
}
.into(),
);
2021-01-24 16:05:52 +01:00
}
RuleKind::Content => {
global.content.replace(
2021-01-24 16:05:52 +01:00
PatternedPushRuleInit {
actions: body.actions,
2021-01-24 16:05:52 +01:00
default: false,
enabled: true,
rule_id: body.rule_id,
pattern: body.pattern.unwrap_or_default(),
2021-01-24 16:05:52 +01:00
}
.into(),
);
2021-01-24 16:05:52 +01:00
}
2021-07-15 19:54:04 +02:00
_ => {}
2021-01-24 16:05:52 +01:00
}
services().account_data.update(
2022-04-06 21:31:29 +02:00
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
2022-10-05 15:33:57 +02:00
&serde_json::to_value(account_data).expect("to json value always works"),
2022-04-06 21:31:29 +02:00
)?;
2022-02-18 15:33:14 +01:00
Ok(set_pushrule::v3::Response {})
2020-07-30 18:14:47 +02:00
}
2021-08-31 19:14:37 +02:00
/// # `GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/actions`
///
/// Gets the actions of a single specified push rule for this user.
2021-01-24 16:05:52 +01:00
pub async fn get_pushrule_actions_route(
2022-04-06 21:31:29 +02:00
body: Ruma<get_pushrule_actions::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<get_pushrule_actions::v3::Response> {
2021-01-24 16:05:52 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != "global" {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?
.content;
let global = account_data.global;
2021-01-24 16:05:52 +01:00
let actions = match body.kind {
RuleKind::Override => global
.override_
.get(body.rule_id.as_str())
.map(|rule| rule.actions.clone()),
2021-01-24 16:05:52 +01:00
RuleKind::Underride => global
.underride
.get(body.rule_id.as_str())
.map(|rule| rule.actions.clone()),
2021-01-24 16:05:52 +01:00
RuleKind::Sender => global
.sender
.get(body.rule_id.as_str())
.map(|rule| rule.actions.clone()),
2021-01-24 16:05:52 +01:00
RuleKind::Room => global
.room
.get(body.rule_id.as_str())
.map(|rule| rule.actions.clone()),
2021-01-24 16:05:52 +01:00
RuleKind::Content => global
.content
.get(body.rule_id.as_str())
.map(|rule| rule.actions.clone()),
2021-07-15 19:54:04 +02:00
_ => None,
2021-01-24 16:05:52 +01:00
};
2022-02-18 15:33:14 +01:00
Ok(get_pushrule_actions::v3::Response {
2021-01-24 16:05:52 +01:00
actions: actions.unwrap_or_default(),
})
2021-01-24 16:05:52 +01:00
}
2021-08-31 19:14:37 +02:00
/// # `PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/actions`
///
/// Sets the actions of a single specified push rule for this user.
2021-01-24 16:05:52 +01:00
pub async fn set_pushrule_actions_route(
2022-04-06 21:31:29 +02:00
body: Ruma<set_pushrule_actions::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<set_pushrule_actions::v3::Response> {
2021-01-24 16:05:52 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != "global" {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let mut account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?;
let global = &mut account_data.content.global;
2021-01-24 16:05:52 +01:00
match body.kind {
RuleKind::Override => {
if let Some(mut rule) = global.override_.get(body.rule_id.as_str()).cloned() {
rule.actions = body.actions.clone();
global.override_.replace(rule);
2021-01-24 16:05:52 +01:00
}
}
RuleKind::Underride => {
if let Some(mut rule) = global.underride.get(body.rule_id.as_str()).cloned() {
rule.actions = body.actions.clone();
global.underride.replace(rule);
2021-01-24 16:05:52 +01:00
}
}
RuleKind::Sender => {
if let Some(mut rule) = global.sender.get(body.rule_id.as_str()).cloned() {
rule.actions = body.actions.clone();
global.sender.replace(rule);
2021-01-24 16:05:52 +01:00
}
}
RuleKind::Room => {
if let Some(mut rule) = global.room.get(body.rule_id.as_str()).cloned() {
rule.actions = body.actions.clone();
global.room.replace(rule);
2021-01-24 16:05:52 +01:00
}
}
RuleKind::Content => {
if let Some(mut rule) = global.content.get(body.rule_id.as_str()).cloned() {
rule.actions = body.actions.clone();
global.content.replace(rule);
2021-01-24 16:05:52 +01:00
}
}
2021-07-15 19:54:04 +02:00
_ => {}
2021-01-24 16:05:52 +01:00
};
services().account_data.update(
2022-04-06 21:31:29 +02:00
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
2022-10-05 15:33:57 +02:00
&serde_json::to_value(account_data).expect("to json value always works"),
2022-04-06 21:31:29 +02:00
)?;
2021-01-24 16:05:52 +01:00
2022-02-18 15:33:14 +01:00
Ok(set_pushrule_actions::v3::Response {})
2021-01-24 16:05:52 +01:00
}
2021-08-31 19:14:37 +02:00
/// # `GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/enabled`
///
/// Gets the enabled status of a single specified push rule for this user.
2021-01-24 16:05:52 +01:00
pub async fn get_pushrule_enabled_route(
2022-04-06 21:31:29 +02:00
body: Ruma<get_pushrule_enabled::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<get_pushrule_enabled::v3::Response> {
2021-01-24 16:05:52 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != "global" {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?;
let global = account_data.content.global;
2021-01-24 16:05:52 +01:00
let enabled = match body.kind {
RuleKind::Override => global
.override_
.iter()
.find(|rule| rule.rule_id == body.rule_id)
.map_or(false, |rule| rule.enabled),
2021-01-24 16:05:52 +01:00
RuleKind::Underride => global
.underride
.iter()
.find(|rule| rule.rule_id == body.rule_id)
.map_or(false, |rule| rule.enabled),
2021-01-24 16:05:52 +01:00
RuleKind::Sender => global
.sender
.iter()
.find(|rule| rule.rule_id == body.rule_id)
.map_or(false, |rule| rule.enabled),
2021-01-24 16:05:52 +01:00
RuleKind::Room => global
.room
.iter()
.find(|rule| rule.rule_id == body.rule_id)
.map_or(false, |rule| rule.enabled),
2021-01-24 16:05:52 +01:00
RuleKind::Content => global
.content
.iter()
.find(|rule| rule.rule_id == body.rule_id)
.map_or(false, |rule| rule.enabled),
2021-07-15 19:54:04 +02:00
_ => false,
2021-01-24 16:05:52 +01:00
};
2022-02-18 15:33:14 +01:00
Ok(get_pushrule_enabled::v3::Response { enabled })
2021-01-24 16:05:52 +01:00
}
2021-08-31 19:14:37 +02:00
/// # `PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/enabled`
///
/// Sets the enabled status of a single specified push rule for this user.
pub async fn set_pushrule_enabled_route(
2022-04-06 21:31:29 +02:00
body: Ruma<set_pushrule_enabled::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<set_pushrule_enabled::v3::Response> {
2021-01-24 16:05:52 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != "global" {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let mut account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?;
let global = &mut account_data.content.global;
2021-01-24 16:05:52 +01:00
match body.kind {
RuleKind::Override => {
if let Some(mut rule) = global.override_.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.override_.remove(&rule);
rule.enabled = body.enabled;
2021-01-24 16:05:52 +01:00
global.override_.insert(rule);
}
}
RuleKind::Underride => {
if let Some(mut rule) = global.underride.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.underride.remove(&rule);
rule.enabled = body.enabled;
2021-01-24 16:05:52 +01:00
global.underride.insert(rule);
}
}
RuleKind::Sender => {
if let Some(mut rule) = global.sender.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.sender.remove(&rule);
rule.enabled = body.enabled;
2021-01-24 16:05:52 +01:00
global.sender.insert(rule);
}
}
RuleKind::Room => {
if let Some(mut rule) = global.room.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.room.remove(&rule);
rule.enabled = body.enabled;
2021-01-24 16:05:52 +01:00
global.room.insert(rule);
}
}
RuleKind::Content => {
if let Some(mut rule) = global.content.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.content.remove(&rule);
rule.enabled = body.enabled;
2021-01-24 16:05:52 +01:00
global.content.insert(rule);
}
}
2021-07-15 19:54:04 +02:00
_ => {}
2021-01-24 16:05:52 +01:00
}
services().account_data.update(
2022-04-06 21:31:29 +02:00
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
2022-10-05 15:33:57 +02:00
&serde_json::to_value(account_data).expect("to json value always works"),
2022-04-06 21:31:29 +02:00
)?;
2022-02-18 15:33:14 +01:00
Ok(set_pushrule_enabled::v3::Response {})
2020-07-30 18:14:47 +02:00
}
2021-08-31 19:14:37 +02:00
/// # `DELETE /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}`
///
/// Deletes a single specified push rule for this user.
2021-01-24 16:05:52 +01:00
pub async fn delete_pushrule_route(
2022-04-06 21:31:29 +02:00
body: Ruma<delete_pushrule::v3::IncomingRequest>,
2022-02-18 15:33:14 +01:00
) -> Result<delete_pushrule::v3::Response> {
2021-01-24 16:05:52 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != "global" {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
2022-10-05 15:33:57 +02:00
let event = services()
2021-01-24 16:05:52 +01:00
.account_data
2022-04-06 21:31:29 +02:00
.get(
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
)?
2021-01-24 16:05:52 +01:00
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
))?;
2022-10-05 15:33:57 +02:00
let mut account_data = serde_json::from_str::<PushRulesEvent>(event.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))?;
let global = &mut account_data.content.global;
2021-01-24 16:05:52 +01:00
match body.kind {
RuleKind::Override => {
if let Some(rule) = global.override_.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.override_.remove(&rule);
}
}
RuleKind::Underride => {
if let Some(rule) = global.underride.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.underride.remove(&rule);
}
}
RuleKind::Sender => {
if let Some(rule) = global.sender.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.sender.remove(&rule);
}
}
RuleKind::Room => {
if let Some(rule) = global.room.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.room.remove(&rule);
}
}
RuleKind::Content => {
if let Some(rule) = global.content.get(body.rule_id.as_str()).cloned() {
2021-01-24 16:05:52 +01:00
global.content.remove(&rule);
}
}
2021-07-15 19:54:04 +02:00
_ => {}
2021-01-24 16:05:52 +01:00
}
services().account_data.update(
2022-04-06 21:31:29 +02:00
None,
sender_user,
GlobalAccountDataEventType::PushRules.to_string().into(),
2022-10-05 15:33:57 +02:00
&serde_json::to_value(account_data).expect("to json value always works"),
2022-04-06 21:31:29 +02:00
)?;
2021-01-24 16:05:52 +01:00
2022-02-18 15:33:14 +01:00
Ok(delete_pushrule::v3::Response {})
2021-01-24 16:05:52 +01:00
}
2021-08-31 19:14:37 +02:00
/// # `GET /_matrix/client/r0/pushers`
///
/// Gets all currently active pushers for the sender user.
pub async fn get_pushers_route(
2022-02-18 15:33:14 +01:00
body: Ruma<get_pushers::v3::Request>,
) -> Result<get_pushers::v3::Response> {
2021-03-16 18:00:26 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
2022-02-18 15:33:14 +01:00
Ok(get_pushers::v3::Response {
pushers: services().pusher.get_pushers(sender_user)?,
})
2020-07-30 18:14:47 +02:00
}
2021-08-31 19:14:37 +02:00
/// # `POST /_matrix/client/r0/pushers/set`
///
/// Adds a pusher for the sender user.
///
/// - TODO: Handle `append`
pub async fn set_pushers_route(
2022-02-18 15:33:14 +01:00
body: Ruma<set_pusher::v3::Request>,
) -> Result<set_pusher::v3::Response> {
2021-03-16 18:00:26 +01:00
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let pusher = body.pusher.clone();
services().pusher.set_pusher(sender_user, pusher)?;
2022-02-18 15:33:14 +01:00
Ok(set_pusher::v3::Response::default())
2020-07-30 18:14:47 +02:00
}