Removed counting of unread topics from unread state in filters.

This commit is contained in:
23rd 2024-11-25 17:44:49 +03:00
parent 021a5881c2
commit f888008dc1
4 changed files with 12 additions and 2 deletions

View file

@ -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;

View file

@ -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;
@ -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;
@ -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;

View file

@ -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);

View file

@ -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()