Revert tag change, update partials to include ids.
This commit is contained in:
@@ -6,7 +6,7 @@ use rocket_contrib::json::JsonValue;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
#[serde(tag = "channel_type")]
|
#[serde(tag = "type")]
|
||||||
pub enum Channel {
|
pub enum Channel {
|
||||||
SavedMessages {
|
SavedMessages {
|
||||||
#[serde(rename = "_id")]
|
#[serde(rename = "_id")]
|
||||||
@@ -64,12 +64,11 @@ impl Channel {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn publish_update(&self, partial: JsonValue) -> Result<()> {
|
pub async fn publish_update(&self, data: JsonValue) -> Result<()> {
|
||||||
let id = self.id().to_string();
|
let id = self.id().to_string();
|
||||||
ClientboundNotification::ChannelUpdate(partial)
|
ClientboundNotification::ChannelUpdate {
|
||||||
.publish(id)
|
id: id.clone(), data
|
||||||
.await
|
}.publish(id).await.ok();
|
||||||
.ok();
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,12 +53,11 @@ impl Message {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn publish_update(&self, partial: JsonValue) -> Result<()> {
|
pub async fn publish_update(&self, data: JsonValue) -> Result<()> {
|
||||||
let channel = self.channel.clone();
|
let channel = self.channel.clone();
|
||||||
ClientboundNotification::MessageUpdate(partial)
|
ClientboundNotification::MessageUpdate {
|
||||||
.publish(channel)
|
id: self.id.clone(), data
|
||||||
.await
|
}.publish(channel).await.ok();
|
||||||
.ok();
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,19 @@ pub enum ClientboundNotification {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Message(Message),
|
Message(Message),
|
||||||
MessageUpdate(JsonValue),
|
MessageUpdate {
|
||||||
|
id: String,
|
||||||
|
data: JsonValue
|
||||||
|
},
|
||||||
MessageDelete {
|
MessageDelete {
|
||||||
id: String,
|
id: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
ChannelCreate(Channel),
|
ChannelCreate(Channel),
|
||||||
ChannelUpdate(JsonValue),
|
ChannelUpdate {
|
||||||
|
id: String,
|
||||||
|
data: JsonValue
|
||||||
|
},
|
||||||
ChannelGroupJoin {
|
ChannelGroupJoin {
|
||||||
id: String,
|
id: String,
|
||||||
user: String,
|
user: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user