fix(patches): hide dm row from dialogs list for hidden users
closes arcanegram/arcanegram#1. shouldBeInChatList returns false for hidden user dms. on hide/unhide toggle, refresh chat-list existence so the row disappears/reappears without restart.
This commit is contained in:
parent
bc711452e0
commit
cd6aa83bdc
5 changed files with 54 additions and 0 deletions
33
patches/feature/hidden-users-dialog-row.patch
Normal file
33
patches/feature/hidden-users-dialog-row.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: devilreef <devilreef@femboy.page>
|
||||
Date: Wed, 29 Apr 2026 14:32:47 +0600
|
||||
Subject: [PATCH] hide dm row from dialogs list for hidden users
|
||||
|
||||
---
|
||||
Telegram/SourceFiles/history/history.cpp | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp
|
||||
index 0000000..0000000 100644
|
||||
--- a/Telegram/SourceFiles/history/history.cpp
|
||||
+++ b/Telegram/SourceFiles/history/history.cpp
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "history/history.h"
|
||||
|
||||
+#include "arcanegram/features/ag_hidden_users.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "history/view/history_view_item_preview.h"
|
||||
#include "history/view/history_view_translate_tracker.h"
|
||||
@@ -3145,6 +3146,8 @@ bool History::trackUnreadMessages() const {
|
||||
bool History::shouldBeInChatList() const {
|
||||
if (peer->migrateTo() || !folderKnown()) {
|
||||
return false;
|
||||
+ } else if (peer->isUser() && Arcanegram::HiddenUsers::IsHidden(peer->id)) {
|
||||
+ return false;
|
||||
} else if (isPinnedDialog(FilterId())) {
|
||||
return true;
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
--
|
||||
2.52.0.windows.1
|
||||
|
||||
1
series
1
series
|
|
@ -15,6 +15,7 @@ feature/hidden-users-profile-menu.patch
|
|||
feature/hidden-users-element-hide.patch
|
||||
feature/hidden-users-reactions.patch
|
||||
feature/hidden-users-who-reacted.patch
|
||||
feature/hidden-users-dialog-row.patch
|
||||
feature/hidden-users-typing.patch
|
||||
feature/disable-chat-wallpaper.patch
|
||||
misc/copy-id-url-handler.patch
|
||||
|
|
|
|||
|
|
@ -52,6 +52,20 @@ void ForEachLoadedItem(Fn<void(not_null<HistoryItem*>)> action) {
|
|||
});
|
||||
}
|
||||
|
||||
void ForEachLoadedHistoryFor(
|
||||
PeerId id,
|
||||
Fn<void(not_null<History*>)> action) {
|
||||
for (const auto &entry : Core::App().domain().accounts()) {
|
||||
const auto session = entry.account->maybeSession();
|
||||
if (!session) {
|
||||
continue;
|
||||
}
|
||||
if (const auto h = session->data().historyLoaded(id)) {
|
||||
action(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshAllItems() {
|
||||
ForEachLoadedHistory([](not_null<History*> h) {
|
||||
auto &owner = h->owner();
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
#include "base/basic_types.h"
|
||||
|
||||
class History;
|
||||
class HistoryItem;
|
||||
|
||||
namespace Arcanegram {
|
||||
|
||||
void ForEachLoadedItem(Fn<void(not_null<HistoryItem*>)> action);
|
||||
|
||||
void ForEachLoadedHistoryFor(PeerId id, Fn<void(not_null<History*>)> action);
|
||||
|
||||
void RefreshAllItems();
|
||||
|
||||
} // namespace Arcanegram
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ void Save() {
|
|||
}
|
||||
|
||||
void RefreshAll(PeerId changed) {
|
||||
ForEachLoadedHistoryFor(changed, [](not_null<History*> history) {
|
||||
history->updateChatListExistence();
|
||||
});
|
||||
ForEachLoadedItem([changed](not_null<HistoryItem*> item) {
|
||||
auto &owner = item->history()->owner();
|
||||
const auto from = item->from();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue