summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-07-31 17:23:00 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-07-31 17:23:00 -0400
commit4e4986f6709cfc7f8e4cae734e8579695f3c07b4 (patch)
tree3bad6400b5fbe606bd538918ee9a12dacbbd98d5 /src
parentccf5afbba959068f34897b75afcd25c65c96d79c (diff)
downloadabaddon-portaudio-4e4986f6709cfc7f8e4cae734e8579695f3c07b4.tar.gz
abaddon-portaudio-4e4986f6709cfc7f8e4cae734e8579695f3c07b4.zip
grey out leave button if user owns the guild
Diffstat (limited to 'src')
-rw-r--r--src/components/channels.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/components/channels.cpp b/src/components/channels.cpp
index 0a49701..497c021 100644
--- a/src/components/channels.cpp
+++ b/src/components/channels.cpp
@@ -911,10 +911,15 @@ void ChannelList::OnGuildSubmenuPopup() {
const auto iter = m_model->get_iter(m_path_for_menu);
if (!iter) return;
const auto id = static_cast<Snowflake>((*iter)[m_columns.m_id]);
- if (Abaddon::Get().GetDiscordClient().IsGuildMuted(id))
+ auto &discord = Abaddon::Get().GetDiscordClient();
+ if (discord.IsGuildMuted(id))
m_menu_guild_toggle_mute.set_label("Unmute");
else
m_menu_guild_toggle_mute.set_label("Mute");
+
+ const auto guild = discord.GetGuild(id);
+ const auto self_id = discord.GetUserData().ID;
+ m_menu_guild_leave.set_sensitive(!(guild.has_value() && guild->OwnerID == self_id));
}
void ChannelList::OnCategorySubmenuPopup() {