Move new subscriptions to a unfied prehandle function.

This commit is contained in:
Paul Makles
2021-01-19 11:46:22 +00:00
parent c21d7c4620
commit 8cbba0671d
7 changed files with 45 additions and 30 deletions

View File

@@ -56,19 +56,7 @@ impl Channel {
with: "channel",
})?;
// ! IMPORTANT FIXME: THESE SUBSCRIPTIONS SHOULD BE DONE FROM HIVE NOT HERE!!!
let channel_id = self.id().to_string();
match &self {
Channel::SavedMessages { user, .. } => {
hive::subscribe_if_exists(user.clone(), channel_id.clone()).ok();
}
Channel::DirectMessage { recipients, .. } | Channel::Group { recipients, .. } => {
for recipient in recipients {
hive::subscribe_if_exists(recipient.clone(), channel_id.clone()).ok();
}
}
}
ClientboundNotification::ChannelCreate(self)
.publish(channel_id)
.await