update code to be inline with reviews
This commit is contained in:
@@ -26,7 +26,7 @@ impl AbstractWebhook for DummyDb {
|
||||
})
|
||||
}
|
||||
|
||||
async fn update_webook(&self, webhook_id: &str, partial_webhook: &PartialWebhook, remove: &[FieldsWebhook]) -> Result<()> {
|
||||
async fn update_webhook(&self, webhook_id: &str, partial_webhook: &PartialWebhook, remove: &[FieldsWebhook]) -> Result<()> {
|
||||
info!("updating webhook {webhook_id}, {partial_webhook:?}, removing {remove:?}");
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -42,7 +42,7 @@ impl Webhook {
|
||||
|
||||
self.apply_options(partial.clone());
|
||||
|
||||
db.update_webook(&self.id, &partial, &remove).await?;
|
||||
db.update_webhook(&self.id, &partial, &remove).await?;
|
||||
|
||||
partial.token = None; // Avoid leaking the token to people who receive the event
|
||||
|
||||
@@ -65,7 +65,6 @@ impl Webhook {
|
||||
|
||||
pub fn into_message_webhook(self) -> MessageWebhook {
|
||||
MessageWebhook {
|
||||
id: self.id,
|
||||
name: self.name,
|
||||
avatar: self.avatar.map(|f| f.id)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ impl AbstractWebhook for MongoDb {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_webook(&self, webhook_id: &str, partial_webhook: &PartialWebhook, remove: &[FieldsWebhook]) -> Result<()> {
|
||||
async fn update_webhook(&self, webhook_id: &str, partial_webhook: &PartialWebhook, remove: &[FieldsWebhook]) -> Result<()> {
|
||||
self.update_one_by_id(
|
||||
COL,
|
||||
webhook_id,
|
||||
|
||||
@@ -112,8 +112,6 @@ pub struct Interactions {
|
||||
/// Information about the webhook which
|
||||
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, Validate, Default)]
|
||||
pub struct MessageWebhook {
|
||||
// Id of Webhook
|
||||
pub id: String,
|
||||
// The name of the webhook - 1 to 32 chars
|
||||
pub name: String,
|
||||
// The id of the avatar of the webhook, if it has one
|
||||
|
||||
@@ -6,6 +6,6 @@ pub trait AbstractWebhook: Sync + Send {
|
||||
async fn insert_webhook(&self, webhook: &Webhook) -> Result<()>;
|
||||
async fn fetch_webhook(&self, webhook_id: &str) -> Result<Webhook>;
|
||||
async fn delete_webhook(&self, webhook_id: &str) -> Result<()>;
|
||||
async fn update_webook(&self, webhook_id: &str, partial_webhook: &PartialWebhook, remove: &[FieldsWebhook]) -> Result<()>;
|
||||
async fn update_webhook(&self, webhook_id: &str, partial_webhook: &PartialWebhook, remove: &[FieldsWebhook]) -> Result<()>;
|
||||
async fn fetch_webhooks_for_channel(&self, channel: &str) -> Result<Vec<Webhook>>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user