mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
parent
c3db2bc843
commit
7c21c41638
1 changed files with 17 additions and 2 deletions
|
@ -3123,11 +3123,26 @@ Cache::getRoomName(lmdb::txn &txn, lmdb::dbi &statesdb, lmdb::dbi &membersdb)
|
|||
|
||||
return localUserId_;
|
||||
}();
|
||||
auto second_member = [&members, this]() {
|
||||
bool first = true;
|
||||
for (const auto &m : members) {
|
||||
if (m.first != localUserId_.toStdString()) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
return QString::fromStdString(m.second.name);
|
||||
}
|
||||
}
|
||||
|
||||
return localUserId_;
|
||||
}();
|
||||
|
||||
if (total == 2)
|
||||
return first_member;
|
||||
else if (total > 2)
|
||||
return tr("%1 and %n other(s)", "", (int)total - 1).arg(first_member);
|
||||
else if (total == 3)
|
||||
return tr("%1 and %2", "RoomName").arg(first_member, second_member);
|
||||
else if (total > 3)
|
||||
return tr("%1 and %n other(s)", "", (int)total - 2).arg(first_member);
|
||||
|
||||
return tr("Empty Room");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue