summaryrefslogtreecommitdiff
path: root/src/components/chatinput.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2023-07-15 17:18:04 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2023-07-15 17:18:04 -0400
commitadd48af094ec9111727862d3f2ee1916474a2471 (patch)
treeeffb97ff9c741cd90a67ba8c88c24d779300529d /src/components/chatinput.cpp
parent03e617a146666ad95f8cf9ff144f1cec4ae4c6cd (diff)
downloadabaddon-portaudio-add48af094ec9111727862d3f2ee1916474a2471.tar.gz
abaddon-portaudio-add48af094ec9111727862d3f2ee1916474a2471.zip
restrict attachments when editing
Diffstat (limited to 'src/components/chatinput.cpp')
-rw-r--r--src/components/chatinput.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp
index f53c6fe..1133302 100644
--- a/src/components/chatinput.cpp
+++ b/src/components/chatinput.cpp
@@ -570,12 +570,16 @@ void ChatInput::StopReplying() {
}
void ChatInput::StartEditing(const Message &message) {
+ m_is_editing = true;
m_input.Get().grab_focus();
m_input.Get().get_style_context()->add_class("editing");
GetBuffer()->set_text(message.Content);
+ m_attachments.Clear();
+ m_attachments_revealer.set_reveal_child(false);
}
void ChatInput::StopEditing() {
+ m_is_editing = false;
m_input.Get().get_style_context()->remove_class("editing");
}
@@ -595,7 +599,7 @@ bool ChatInput::AddFileAsImageAttachment(const Glib::RefPtr<Gio::File> &file) {
}
bool ChatInput::CanAttachFiles() {
- return Abaddon::Get().GetDiscordClient().HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES | Permission::SEND_MESSAGES);
+ return !m_is_editing && Abaddon::Get().GetDiscordClient().HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES | Permission::SEND_MESSAGES);
}
ChatInput::type_signal_submit ChatInput::signal_submit() {