show news channels

This commit is contained in:
ouwou committed 2020-11-01 17:15:34 -05:00
1 parent 77b187bd64
commit 8efa202458
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -264,7 +264,7 @@ void Abaddon::ActionChannelOpened(Snowflake id) {
if (channel->Type != ChannelType::DM && channel->Type != ChannelType::GROUP_DM)
m_discord.SendLazyLoad(id);
if (channel->Type == ChannelType::GUILD_TEXT)
if (channel->Type == ChannelType::GUILD_TEXT || channel->Type == ChannelType::GUILD_NEWS)
m_main_window->set_title(std::string(APP_TITLE) + " - #" + channel->Name);
else {
std::string display;
+2 -2
View File
@@ -369,7 +369,7 @@ void ChannelList::UpdateCreateChannel(Snowflake id) {
}
ChannelListRow *row;
if (data->Type == ChannelType::GUILD_TEXT) {
if (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS) {
row = Gtk::manage(new ChannelListRowChannel(data));
} else if (data->Type == ChannelType::GUILD_CATEGORY) {
row = Gtk::manage(new ChannelListRowCategory(data));
@@ -478,7 +478,7 @@ void ChannelList::InsertGuildAt(Snowflake id, int pos) {
std::map<int, const Channel *> orphan_channels;
std::unordered_map<Snowflake, std::vector<const Channel *>> cat_to_channels;
for (const auto &channel : guild_data->Channels) {
if (channel.Type != ChannelType::GUILD_TEXT) continue;
if (channel.Type != ChannelType::GUILD_TEXT && channel.Type != ChannelType::GUILD_NEWS) continue;
if (channel.ParentID.IsValid())
cat_to_channels[channel.ParentID].push_back(&channel);
+2 -2
View File
@@ -134,9 +134,9 @@ std::vector<Snowflake> Guild::GetSortedChannels(Snowflake ignore) const {
for (const auto &channel_id : channels) {
const auto *data = discord.GetChannel(channel_id);
if (data == nullptr) continue;
if (!data->ParentID.IsValid() && data->Type == ChannelType::GUILD_TEXT)
if (!data->ParentID.IsValid() && (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS))
orphan_channels[data->Position].push_back(data);
else if (data->ParentID.IsValid() && data->Type == ChannelType::GUILD_TEXT)
else if (data->ParentID.IsValid() && (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS))
category_to_channels[data->ParentID].push_back(data);
else if (data->Type == ChannelType::GUILD_CATEGORY)
position_to_categories[data->Position].push_back(data);