Skip to content

Commit

Permalink
Removed counting of unread topics from unread state in filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Nov 25, 2024
1 parent 021a588 commit f888008
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions Telegram/SourceFiles/data/data_forum_topic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ Dialogs::UnreadState ForumTopic::unreadStateFor(
const auto muted = this->muted();
result.messages = count;
result.chats = count ? 1 : 0;
result.chatsTopic = count ? 1 : 0;
result.mentions = unreadMentions().has() ? 1 : 0;
result.reactions = unreadReactions().has() ? 1 : 0;
result.messagesMuted = muted ? result.messages : 0;
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/dialogs/dialogs_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct UnreadState {
int messagesMuted = 0;
int chats = 0;
int chatsMuted = 0;
int chatsTopic = 0;
int marks = 0;
int marksMuted = 0;
int reactions = 0;
Expand All @@ -77,6 +78,7 @@ struct UnreadState {
messagesMuted += other.messagesMuted;
chats += other.chats;
chatsMuted += other.chatsMuted;
chatsTopic += other.chatsTopic;
marks += other.marks;
marksMuted += other.marksMuted;
reactions += other.reactions;
Expand All @@ -89,6 +91,7 @@ struct UnreadState {
messagesMuted -= other.messagesMuted;
chats -= other.chats;
chatsMuted -= other.chatsMuted;
chatsTopic -= other.chatsTopic;
marks -= other.marks;
marksMuted -= other.marksMuted;
reactions -= other.reactions;
Expand Down
5 changes: 4 additions & 1 deletion Telegram/SourceFiles/ui/widgets/chat_filters_tabs_strip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,11 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
) | rpl::start_with_next([=](
const Dialogs::UnreadState &state,
bool includeMuted) {
const auto chats = state.chatsTopic
? (state.chats - state.chatsTopic + 1)
: state.chats;
const auto muted = (state.chatsMuted + state.marksMuted);
const auto count = (state.chats + state.marks)
const auto count = (chats + state.marks)
- (includeMuted ? 0 : muted);
const auto isMuted = includeMuted && (count == muted);
slider->setUnreadCount(i, count, isMuted);
Expand Down
5 changes: 4 additions & 1 deletion Telegram/SourceFiles/window/window_filters_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,11 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
) | rpl::start_with_next([=](
const Dialogs::UnreadState &state,
bool includeMuted) {
const auto chats = state.chatsTopic
? (state.chats - state.chatsTopic + 1)
: state.chats;
const auto muted = (state.chatsMuted + state.marksMuted);
const auto count = (state.chats + state.marks)
const auto count = (chats + state.marks)
- (includeMuted ? 0 : muted);
const auto string = !count
? QString()
Expand Down

0 comments on commit f888008

Please sign in to comment.