From 53ac8533671d08e96896b80cd513ba05aabd930f Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 8 Aug 2022 00:29:18 -0400 Subject: [PATCH] fix some permission checks --- src/components/chatinput.cpp | 2 +- src/components/chatwindow.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp index 63bd48b..75dda8d 100644 --- a/src/components/chatinput.cpp +++ b/src/components/chatinput.cpp @@ -549,7 +549,7 @@ bool ChatInput::AddFileAsImageAttachment(const Glib::RefPtr &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() { diff --git a/src/components/chatwindow.cpp b/src/components/chatwindow.cpp index 58e36d0..c5b4d14 100644 --- a/src/components/chatwindow.cpp +++ b/src/components/chatwindow.cpp @@ -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;