summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-08-21 03:53:53 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-08-21 03:53:53 -0400
commit962cda957d21e633e3f3ecea5c0e3e84a782d367 (patch)
treeaa1f1bb74b264b14499a286c46ab0088d223aa49 /components
parent8059e524f166cdcb08f5ee7f3a3c8e72ffdd5d5b (diff)
parent5c63fe94874b7629da28813d6c7363a002ed5fee (diff)
downloadabaddon-portaudio-962cda957d21e633e3f3ecea5c0e3e84a782d367.tar.gz
abaddon-portaudio-962cda957d21e633e3f3ecea5c0e3e84a782d367.zip
merge master
Diffstat (limited to 'components')
-rw-r--r--components/chatlist.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/components/chatlist.cpp b/components/chatlist.cpp
index 86460b9..ba10de9 100644
--- a/components/chatlist.cpp
+++ b/components/chatlist.cpp
@@ -168,18 +168,22 @@ void ChatList::ProcessNewMessage(const Message &data, bool prepend) {
const auto &client = Abaddon::Get().GetDiscordClient();
const auto data = client.GetMessage(id);
if (!data.has_value()) return false;
+ const auto channel = client.GetChannel(m_active_channel);
+
+ bool is_dm = channel.has_value() && (channel->Type == ChannelType::DM || channel->Type == ChannelType::GROUP_DM);
+ const bool has_manage = client.HasChannelPermission(client.GetUserData().ID, m_active_channel, Permission::MANAGE_MESSAGES);
m_menu_edit_message->set_visible(!m_use_pinned_menu);
m_menu_reply_to->set_visible(!m_use_pinned_menu);
- m_menu_unpin->set_visible(data->IsPinned);
- m_menu_pin->set_visible(!data->IsPinned);
+ m_menu_unpin->set_visible((is_dm || has_manage) && data->IsPinned);
+ m_menu_pin->set_visible((is_dm || has_manage) && !data->IsPinned);
if (data->IsDeleted()) {
m_menu_delete_message->set_sensitive(false);
m_menu_edit_message->set_sensitive(false);
} else {
const bool can_edit = client.GetUserData().ID == data->Author.ID;
- const bool can_delete = can_edit || client.HasChannelPermission(client.GetUserData().ID, m_active_channel, Permission::MANAGE_MESSAGES);
+ const bool can_delete = can_edit || has_manage;
m_menu_delete_message->set_sensitive(can_delete);
m_menu_edit_message->set_sensitive(can_edit);
}