mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-13 20:18:50 +03:00
actually retrieve roles for guilds
FetchRoles isnt needed anymore cuz full roles are fetched now
This commit is contained in:
@@ -238,9 +238,10 @@ GuildSettingsMembersPaneRoles::GuildSettingsMembersPaneRoles(Snowflake guild_id)
|
||||
discord.signal_role_delete().connect(sigc::mem_fun(*this, &GuildSettingsMembersPaneRoles::OnRoleDelete));
|
||||
|
||||
const auto guild = *discord.GetGuild(guild_id);
|
||||
const auto roles = guild.FetchRoles();
|
||||
for (const auto &role : roles) {
|
||||
CreateRow(can_modify, role, guild.OwnerID == self_id);
|
||||
if (guild.Roles.has_value()) {
|
||||
for (const auto &role : *guild.Roles) {
|
||||
CreateRow(can_modify, role, guild.OwnerID == self_id);
|
||||
}
|
||||
}
|
||||
|
||||
m_list.set_sort_func([this](Gtk::ListBoxRow *a, Gtk::ListBoxRow *b) -> int {
|
||||
|
||||
@@ -79,19 +79,20 @@ GuildSettingsRolesPaneRoles::GuildSettingsRolesPaneRoles(Snowflake guild_id)
|
||||
discord.signal_role_delete().connect(sigc::mem_fun(*this, &GuildSettingsRolesPaneRoles::OnRoleDelete));
|
||||
|
||||
const auto guild = *discord.GetGuild(GuildID);
|
||||
const auto roles = guild.FetchRoles();
|
||||
const bool can_modify = discord.HasGuildPermission(discord.GetUserData().ID, GuildID, Permission::MANAGE_ROLES);
|
||||
for (const auto &role : roles) {
|
||||
auto *row = Gtk::manage(new GuildSettingsRolesPaneRolesListItem(guild, role));
|
||||
row->drag_source_set(g_target_entries, Gdk::BUTTON1_MASK, Gdk::ACTION_MOVE);
|
||||
row->set_margin_start(5);
|
||||
row->set_halign(Gtk::ALIGN_FILL);
|
||||
row->show();
|
||||
m_rows[role.ID] = row;
|
||||
if (can_modify)
|
||||
m_list.add_draggable(row);
|
||||
else
|
||||
m_list.add(*row);
|
||||
if (guild.Roles.has_value()) {
|
||||
for (const auto &role : *guild.Roles) {
|
||||
auto *row = Gtk::manage(new GuildSettingsRolesPaneRolesListItem(guild, role));
|
||||
row->drag_source_set(g_target_entries, Gdk::BUTTON1_MASK, Gdk::ACTION_MOVE);
|
||||
row->set_margin_start(5);
|
||||
row->set_halign(Gtk::ALIGN_FILL);
|
||||
row->show();
|
||||
m_rows[role.ID] = row;
|
||||
if (can_modify)
|
||||
m_list.add_draggable(row);
|
||||
else
|
||||
m_list.add(*row);
|
||||
}
|
||||
}
|
||||
|
||||
m_list.set_sort_func([this](Gtk::ListBoxRow *rowa_, Gtk::ListBoxRow *rowb_) -> int {
|
||||
|
||||
Reference in New Issue
Block a user