summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-08-08 00:29:18 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-08-08 00:29:18 -0400
commit53ac8533671d08e96896b80cd513ba05aabd930f (patch)
treedc157272fb5a2e34cc67fdf9453c56299c7f9c59
parent1c3867135619d30104229fa26e2daa70f0999373 (diff)
downloadabaddon-portaudio-53ac8533671d08e96896b80cd513ba05aabd930f.tar.gz
abaddon-portaudio-53ac8533671d08e96896b80cd513ba05aabd930f.zip
fix some permission checks
-rw-r--r--src/components/chatinput.cpp2
-rw-r--r--src/components/chatwindow.cpp1
2 files changed, 2 insertions, 1 deletions
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<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() {
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;