Update hidden read receipts MSC

This commit is contained in:
Nicolas Werner 2022-06-14 00:35:28 +02:00
parent 2a6bf8e839
commit 6e1fec1e63
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
4 changed files with 24 additions and 10 deletions

View File

@ -576,7 +576,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare( FetchContent_Declare(
MatrixClient MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG 754800d226f71864d8b6925e47542d509333e998 GIT_TAG a6ca9714490ad0bb0c032e00be4f7d7ebd683378
) )
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "") set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "") set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")

View File

@ -203,7 +203,7 @@ modules:
buildsystem: cmake-ninja buildsystem: cmake-ninja
name: mtxclient name: mtxclient
sources: sources:
- commit: 754800d226f71864d8b6925e47542d509333e998 - commit: a6ca9714490ad0bb0c032e00be4f7d7ebd683378
#tag: v0.7.0 #tag: v0.7.0
type: git type: git
url: https://github.com/Nheko-Reborn/mtxclient.git url: https://github.com/Nheko-Reborn/mtxclient.git

View File

@ -1728,8 +1728,17 @@ Cache::saveState(const mtx::responses::Sync &res)
Receipts receipts; Receipts receipts;
for (const auto &[event_id, userReceipts] : receiptsEv->content.receipts) { for (const auto &[event_id, userReceipts] : receiptsEv->content.receipts) {
for (const auto &[user_id, receipt] : userReceipts.users) { if (auto r = userReceipts.find(mtx::events::ephemeral::Receipt::Read);
receipts[event_id][user_id] = receipt.ts; r != userReceipts.end()) {
for (const auto &[user_id, receipt] : r->second.users) {
receipts[event_id][user_id] = receipt.ts;
}
}
if (userReceipts.count(mtx::events::ephemeral::Receipt::ReadPrivate)) {
auto ts = userReceipts.at(mtx::events::ephemeral::Receipt::ReadPrivate)
.users.at(local_user_id);
if (ts.ts != 0)
receipts[event_id][local_user_id] = ts.ts;
} }
} }
updateReadReceipt(txn, room.first, receipts); updateReadReceipt(txn, room.first, receipts);
@ -1761,12 +1770,15 @@ Cache::saveState(const mtx::responses::Sync &res)
std::vector<QString> receipts; std::vector<QString> receipts;
for (const auto &[event_id, userReceipts] : receiptsEv->content.receipts) { for (const auto &[event_id, userReceipts] : receiptsEv->content.receipts) {
for (const auto &[user_id, receipt] : userReceipts.users) { if (auto r = userReceipts.find(mtx::events::ephemeral::Receipt::Read);
(void)receipt; r != userReceipts.end()) {
for (const auto &[user_id, receipt] : r->second.users) {
(void)receipt;
if (user_id != local_user_id) { if (user_id != local_user_id) {
receipts.push_back(QString::fromStdString(event_id)); receipts.push_back(QString::fromStdString(event_id));
break; break;
}
} }
} }
} }

View File

@ -1172,7 +1172,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
"Show buttons to quickly reply, react or access additional options next to each " "Show buttons to quickly reply, react or access additional options next to each "
"message."); "message.");
case ReadReceipts: case ReadReceipts:
return tr("Show if your message was read.\nStatus is displayed next to timestamps."); return tr(
"Show if your message was read.\nStatus is displayed next to timestamps.\nWarning: "
"If your homeserver does not support this, your rooms will never be marked as read!");
case DesktopNotifications: case DesktopNotifications:
return tr("Notify about received messages when the client is not currently focused."); return tr("Notify about received messages when the client is not currently focused.");
case AlertOnNotification: case AlertOnNotification: