fix some permission checks

This commit is contained in:
ouwou 2022-08-08 00:29:18 -04:00
parent 1c38671356
commit 53ac853367
2 changed files with 2 additions and 1 deletions

View File

@ -549,7 +549,7 @@ bool ChatInput::AddFileAsImageAttachment(const Glib::RefPtr<Gio::File> &file) {
}
bool ChatInput::CanAttachFiles() {
return Abaddon::Get().GetDiscordClient().HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES);
return Abaddon::Get().GetDiscordClient().HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES | Permission::SEND_MESSAGES);
}
ChatInput::type_signal_submit ChatInput::signal_submit() {

View File

@ -223,6 +223,7 @@ Snowflake ChatWindow::GetActiveChannel() const {
bool ChatWindow::OnInputSubmit(ChatSubmitParams data) {
auto &discord = Abaddon::Get().GetDiscordClient();
if (!discord.HasSelfChannelPermission(m_active_channel, Permission::SEND_MESSAGES)) return false;
if (!data.Attachments.empty() && !discord.HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES)) return false;
int nitro_restriction = BaseAttachmentSizeLimit;
const auto nitro = discord.GetUserData().PremiumType;