fix: check server ownership for text channel

refactor: minor cleanup of code
This commit is contained in:
Paul Makles
2023-10-25 10:39:54 +01:00
committed by Paul Makles
parent 21ffea0f9f
commit 456bf7b42a
7 changed files with 155 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
use std::num::NonZeroUsize;
use revolt_result::{create_error, Result};
use revolt_result::{create_error, Result, Error};
use async_std::sync::Mutex;
use once_cell::sync::Lazy;

View File

@@ -344,6 +344,7 @@ impl PermissionQuery for DatabasePermissionQuery<'_> {
| Cow::Owned(Channel::TextChannel { server, .. })
| Cow::Borrowed(Channel::VoiceChannel { server, .. })
| Cow::Owned(Channel::VoiceChannel { server, .. }) => {
// FIXME: may double fetch
if let Ok(server) = self.database.fetch_server(server).await {
self.server.replace(Cow::Owned(server));
}