2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Ignore accents in contacts list sorting.

This commit is contained in:
John Preston
2021-02-19 15:54:27 +04:00
parent 0a678ae8bd
commit f9f52302bb
8 changed files with 36 additions and 6 deletions

View File

@@ -1156,6 +1156,10 @@ void Session::forgetPassportCredentials() {
_passportCredentials = nullptr;
}
QString Session::nameSortKey(const QString &name) const {
return TextUtilities::RemoveAccents(name).toLower();
}
void Session::setupMigrationViewer() {
session().changes().peerUpdates(
PeerUpdate::Flag::Migration
@@ -1203,9 +1207,13 @@ void Session::setupPeerNameViewer() {
session().changes().realtimeNameUpdates(
) | rpl::start_with_next([=](const NameUpdate &update) {
const auto peer = update.peer;
if (const auto history = historyLoaded(peer)) {
history->refreshChatListNameSortKey();
}
const auto &oldLetters = update.oldFirstLetters;
_contactsNoChatsList.peerNameChanged(peer, oldLetters);
_contactsList.peerNameChanged(peer, oldLetters);
}, _lifetime);
}