Messaging: Upsert mentions into unreads.
Messaging: Allow multiple attachment upload.
This commit is contained in:
@@ -31,11 +31,11 @@ pub async fn req(user: User, server: Ref, target: Ref, data: Json<Data>) -> Resu
|
||||
|
||||
let target = target.fetch_user().await?;
|
||||
if target.id == user.id {
|
||||
return Err(Error::InvalidOperation)
|
||||
return Err(Error::InvalidOperation);
|
||||
}
|
||||
|
||||
if target.id == server.owner {
|
||||
return Err(Error::MissingPermission)
|
||||
return Err(Error::MissingPermission);
|
||||
}
|
||||
|
||||
let mut document = doc! {
|
||||
|
||||
@@ -60,7 +60,7 @@ pub async fn req(user: User, target: Ref, info: Json<Data>) -> Result<JsonValue>
|
||||
name: info.name,
|
||||
description: info.description,
|
||||
icon: None,
|
||||
last_message: None
|
||||
last_message: None,
|
||||
};
|
||||
|
||||
channel.clone().publish().await?;
|
||||
|
||||
@@ -25,5 +25,7 @@ pub async fn req(user: User, target: Ref, member: String) -> Result<()> {
|
||||
return Err(Error::MissingPermission);
|
||||
}
|
||||
|
||||
target.remove_member(&member.id.user, RemoveMember::Kick).await
|
||||
target
|
||||
.remove_member(&member.id.user, RemoveMember::Kick)
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -52,14 +52,12 @@ pub async fn req(user: User, info: Json<Data>) -> Result<JsonValue> {
|
||||
name: info.name,
|
||||
description: info.description,
|
||||
channels: vec![cid.clone()],
|
||||
system_messages: Some(
|
||||
SystemMessageChannels {
|
||||
user_joined: Some(cid.clone()),
|
||||
user_left: Some(cid.clone()),
|
||||
user_kicked: Some(cid.clone()),
|
||||
user_banned: Some(cid.clone())
|
||||
}
|
||||
),
|
||||
system_messages: Some(SystemMessageChannels {
|
||||
user_joined: Some(cid.clone()),
|
||||
user_left: Some(cid.clone()),
|
||||
user_kicked: Some(cid.clone()),
|
||||
user_banned: Some(cid.clone()),
|
||||
}),
|
||||
|
||||
icon: None,
|
||||
banner: None,
|
||||
@@ -72,7 +70,7 @@ pub async fn req(user: User, info: Json<Data>) -> Result<JsonValue> {
|
||||
name: "general".to_string(),
|
||||
description: None,
|
||||
icon: None,
|
||||
last_message: None
|
||||
last_message: None,
|
||||
}
|
||||
.publish()
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user