Post-handle hook, partial updates and group delete.

This commit is contained in:
Paul Makles
2021-01-19 13:06:22 +00:00
parent c38977e026
commit 8bb694a1c8
8 changed files with 174 additions and 60 deletions

View File

@@ -25,7 +25,7 @@ pub async fn req(user: User, target: Ref, msg: Ref, edit: Json<Data>) -> Result<
Err(Error::LabelMe)?
}
let mut message = msg.fetch_message().await?;
let message = msg.fetch_message().await?;
if message.author != user.id {
Err(Error::CannotEditMessage)?
}
@@ -50,9 +50,5 @@ pub async fn req(user: User, target: Ref, msg: Ref, edit: Json<Data>) -> Result<
with: "message",
})?;
message.content = edit.content.clone();
message.edited = Some(DateTime(edited));
message.publish_edit().await?;
Ok(())
message.publish_update(json!({ "content": edit.content, "edited": DateTime(edited) })).await
}