mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
Servers: Fetch and edit members.
Permissions: Use bit representation for permissions.
This commit is contained in:
@@ -50,6 +50,12 @@ pub enum RemoveServerField {
|
||||
Description,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum RemoveMemberField {
|
||||
Nickname,
|
||||
Avatar
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum ClientboundNotification {
|
||||
@@ -109,6 +115,12 @@ pub enum ClientboundNotification {
|
||||
ServerDelete {
|
||||
id: String,
|
||||
},
|
||||
ServerMemberUpdate {
|
||||
id: MemberCompositeKey,
|
||||
data: JsonValue,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
clear: Option<RemoveMemberField>,
|
||||
},
|
||||
ServerMemberJoin {
|
||||
id: String,
|
||||
user: String,
|
||||
@@ -168,7 +180,7 @@ pub async fn prehandle_hook(notification: &ClientboundNotification) -> Result<()
|
||||
}
|
||||
Channel::TextChannel { server, .. } => {
|
||||
// ! FIXME: write a better algorithm?
|
||||
let members = Server::fetch_members(server).await?;
|
||||
let members = Server::fetch_member_ids(server).await?;
|
||||
for member in members {
|
||||
subscribe_if_exists(member.clone(), channel_id.to_string()).ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user