2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Use "Feed" name for chats list index and search.

This commit is contained in:
John Preston
2018-01-22 12:33:09 +03:00
parent 89941a8e83
commit 4527c03c0d
26 changed files with 178 additions and 136 deletions

View File

@@ -121,7 +121,7 @@ void PeerData::updateNameDelayed(
Notify::PeerUpdate update(this);
update.flags |= UpdateFlag::NameChanged;
update.oldNameFirstChars = nameFirstChars();
update.oldNameFirstLetters = nameFirstLetters();
if (isUser()) {
if (asUser()->username != newUsername) {
@@ -304,7 +304,7 @@ void PeerData::setUserpicChecked(
void PeerData::fillNames() {
_nameWords.clear();
_nameFirstChars.clear();
_nameFirstLetters.clear();
auto toIndexList = QStringList();
auto appendToIndex = [&](const QString &value) {
if (!value.isEmpty()) {
@@ -318,7 +318,7 @@ void PeerData::fillNames() {
if (appendTranslit) {
appendToIndex(translitRusEng(toIndexList.front()));
}
if (auto user = asUser()) {
if (const auto user = asUser()) {
if (user->nameOrPhone != name) {
appendToIndex(user->nameOrPhone);
}
@@ -326,7 +326,7 @@ void PeerData::fillNames() {
if (isSelf()) {
appendToIndex(lang(lng_saved_messages));
}
} else if (auto channel = asChannel()) {
} else if (const auto channel = asChannel()) {
appendToIndex(channel->username);
}
auto toIndex = toIndexList.join(' ');
@@ -335,7 +335,7 @@ void PeerData::fillNames() {
const auto namesList = TextUtilities::PrepareSearchWords(toIndex);
for (const auto &name : namesList) {
_nameWords.insert(name);
_nameFirstChars.insert(name[0]);
_nameFirstLetters.insert(name[0]);
}
}