From 7c7943b9f607614ba9d0b7d91979e4d3fe2151bd Mon Sep 17 00:00:00 2001
From: Paul <paulmakles@gmail.com>
Date: Tue, 25 May 2021 14:06:23 +0100
Subject: [PATCH] Websocket: Provide channel id for message edit / del.

---
 src/database/entities/message.rs | 3 +++
 src/notifications/events.rs      | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/database/entities/message.rs b/src/database/entities/message.rs
index 79463bb..ccd9954 100644
--- a/src/database/entities/message.rs
+++ b/src/database/entities/message.rs
@@ -226,6 +226,7 @@ impl Message {
         let channel = self.channel.clone();
         ClientboundNotification::MessageUpdate {
             id: self.id.clone(),
+            channel: self.channel.clone(),
             data,
         }
         .publish(channel);
@@ -262,6 +263,7 @@ impl Message {
                         {
                             ClientboundNotification::MessageUpdate {
                                 id,
+                                channel: channel.clone(),
                                 data: json!({ "embeds": embeds }),
                             }
                             .publish(channel);
@@ -293,6 +295,7 @@ impl Message {
         let channel = self.channel.clone();
         ClientboundNotification::MessageDelete {
             id: self.id.clone(),
+            channel: self.channel.clone()
         }
         .publish(channel);
 
diff --git a/src/notifications/events.rs b/src/notifications/events.rs
index f6a90cd..a798a81 100644
--- a/src/notifications/events.rs
+++ b/src/notifications/events.rs
@@ -50,10 +50,12 @@ pub enum ClientboundNotification {
     Message(Message),
     MessageUpdate {
         id: String,
+        channel: String,
         data: JsonValue,
     },
     MessageDelete {
         id: String,
+        channel: String,
     },
 
     ChannelCreate(Channel),
-- 
GitLab