diff --git a/src/app/neochatconfig.kcfg b/src/app/neochatconfig.kcfg
index 6a5b53420..bacdc8c97 100644
--- a/src/app/neochatconfig.kcfg
+++ b/src/app/neochatconfig.kcfg
@@ -49,6 +49,9 @@
true
+
+ true
+
true
@@ -227,4 +230,3 @@
-
diff --git a/src/libneochat/neochatroom.cpp b/src/libneochat/neochatroom.cpp
index 6255275d1..865cb5a42 100644
--- a/src/libneochat/neochatroom.cpp
+++ b/src/libneochat/neochatroom.cpp
@@ -1935,13 +1935,23 @@ bool NeoChatRoom::spaceHasUnreadMessages() const
return SpaceHierarchyCache::instance().spaceHasUnreadMessages(id());
}
-void NeoChatRoom::markAllChildrenMessagesAsRead()
+void NeoChatRoom::markAllChildrenMessagesAsRead(bool sendPublicReceipts)
{
if (isSpace()) {
- SpaceHierarchyCache::instance().markAllChildrenMessagesAsRead(id());
+ SpaceHierarchyCache::instance().markAllChildrenMessagesAsRead(id(), sendPublicReceipts);
}
}
+void NeoChatRoom::markAllMessagesAsRead(bool sendPublicReceipts)
+{
+#if Quotient_VERSION_MINOR >= 10
+ Room::markAllMessagesAsRead(sendPublicReceipts);
+#else
+ Q_UNUSED(sendPublicReceipts)
+ Room::markAllMessagesAsRead();
+#endif
+}
+
QList NeoChatRoom::sortedMemberIds() const
{
return m_sortedMemberIds;
diff --git a/src/libneochat/neochatroom.h b/src/libneochat/neochatroom.h
index becc3bce6..51460e0d0 100644
--- a/src/libneochat/neochatroom.h
+++ b/src/libneochat/neochatroom.h
@@ -679,7 +679,12 @@ public:
/**
* @brief Mark the space and all its children messages as read.
*/
- Q_INVOKABLE void markAllChildrenMessagesAsRead();
+ Q_INVOKABLE void markAllChildrenMessagesAsRead(bool sendPublicReceipts);
+
+ /**
+ * @brief Mark all messages in the room as read up to the latest event.
+ */
+ Q_INVOKABLE void markAllMessagesAsRead(bool sendPublicReceipts = true);
/**
* @return List of members in this room, sorted by power level and then by name.
diff --git a/src/libneochat/spacehierarchycache.cpp b/src/libneochat/spacehierarchycache.cpp
index bc7b44bd5..c5ab68495 100644
--- a/src/libneochat/spacehierarchycache.cpp
+++ b/src/libneochat/spacehierarchycache.cpp
@@ -254,7 +254,7 @@ void SpaceHierarchyCache::setRecommendedSpaceHidden(bool hidden)
Q_EMIT recommendedSpaceHiddenChanged();
}
-void SpaceHierarchyCache::markAllChildrenMessagesAsRead(const QString &spaceId)
+void SpaceHierarchyCache::markAllChildrenMessagesAsRead(const QString &spaceId, bool sendPublicReceipts)
{
const auto children = m_spaceHierarchy[spaceId];
@@ -277,14 +277,14 @@ void SpaceHierarchyCache::markAllChildrenMessagesAsRead(const QString &spaceId)
child,
&NeoChatRoom::addedMessages,
child,
- [child] {
+ [child, sendPublicReceipts] {
if (child->messageEvents().crbegin() != child->historyEdge()) {
- child->markAllMessagesAsRead();
+ child->markAllMessagesAsRead(sendPublicReceipts);
}
},
Qt::SingleShotConnection);
} else {
- child->markAllMessagesAsRead();
+ child->markAllMessagesAsRead(sendPublicReceipts);
}
}
}
diff --git a/src/libneochat/spacehierarchycache.h b/src/libneochat/spacehierarchycache.h
index 39790f828..fad811d5c 100644
--- a/src/libneochat/spacehierarchycache.h
+++ b/src/libneochat/spacehierarchycache.h
@@ -100,7 +100,7 @@ public:
bool recommendedSpaceHidden() const;
void setRecommendedSpaceHidden(bool hidden);
- void markAllChildrenMessagesAsRead(const QString &spaceId);
+ void markAllChildrenMessagesAsRead(const QString &spaceId, bool sendPublicReceipts);
Q_SIGNALS:
void spaceHierarchyChanged();
diff --git a/src/rooms/RoomContextMenu.qml b/src/rooms/RoomContextMenu.qml
index c62bcf2e6..cdc3d25b5 100644
--- a/src/rooms/RoomContextMenu.qml
+++ b/src/rooms/RoomContextMenu.qml
@@ -47,7 +47,7 @@ KirigamiComponents.ConvergentContextMenu {
text: i18nc("@action:inmenu", "Mark as Read")
icon.name: "checkmark"
enabled: root.room.notificationCount > 0 || root.room.highlightCount > 0
- onTriggered: root.room.markAllMessagesAsRead()
+ onTriggered: root.room.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts)
}
Kirigami.Action {
diff --git a/src/rooms/SpaceListContextMenu.qml b/src/rooms/SpaceListContextMenu.qml
index 02afe3145..defbeafc6 100644
--- a/src/rooms/SpaceListContextMenu.qml
+++ b/src/rooms/SpaceListContextMenu.qml
@@ -45,7 +45,7 @@ KirigamiComponents.ConvergentContextMenu {
icon.name: "checkmark"
enabled: root.room.spaceHasUnreadMessages
onTriggered: {
- root.room.markAllChildrenMessagesAsRead();
+ root.room.markAllChildrenMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
}
diff --git a/src/settings/NeoChatSecurityPage.qml b/src/settings/NeoChatSecurityPage.qml
index 488e4049e..7c6e0469d 100644
--- a/src/settings/NeoChatSecurityPage.qml
+++ b/src/settings/NeoChatSecurityPage.qml
@@ -67,8 +67,18 @@ FormCard.FormCardPage {
NeoChatConfig.save();
}
}
+ FormCard.FormCheckDelegate {
+ id: publicReceiptsDelegate
+ text: i18nc("@option:check", "Send read receipts")
+ checked: NeoChatConfig.publicReadReceipts
+ enabled: !NeoChatConfig.isPublicReadReceiptsImmutable
+ onToggled: {
+ NeoChatConfig.publicReadReceipts = checked;
+ NeoChatConfig.save();
+ }
+ }
FormCard.FormDelegateSeparator {
- above: typingNotificationsDelegate
+ above: publicReceiptsDelegate
below: hideImagesDelegate
}
FormCard.FormCheckDelegate {
diff --git a/src/timeline/ReadMarkerDelegate.qml b/src/timeline/ReadMarkerDelegate.qml
index cf77dbd42..4bd423b0c 100644
--- a/src/timeline/ReadMarkerDelegate.qml
+++ b/src/timeline/ReadMarkerDelegate.qml
@@ -73,7 +73,7 @@ TimelineDelegate {
text: i18nc("@action:button Mark all messages up to now as read", "Mark as Read")
icon.name: "checkmark"
- onClicked: root.room.markAllMessagesAsRead()
+ onClicked: root.room.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts)
Layout.alignment: Qt.AlignRight
}
diff --git a/src/timeline/TimelineView.qml b/src/timeline/TimelineView.qml
index be83d6b69..20ed91892 100644
--- a/src/timeline/TimelineView.qml
+++ b/src/timeline/TimelineView.qml
@@ -170,26 +170,26 @@ QQC2.ScrollView {
function onReadMarkerAdded() {
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.EntryVisible && messageListView.allUnreadVisible()) {
- _private.room.markAllMessagesAsRead();
+ _private.room.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
}
function onNewLocalUserEventAdded() {
messageListView.positionViewAtBeginning();
- _private.room.markAllMessagesAsRead();
+ _private.room.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
function onRoomAboutToChange(oldRoom, newRoom) {
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Exit ||
(root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.ExitVisible && messageListView.allUnreadVisible())
) {
- oldRoom.markAllMessagesAsRead();
+ oldRoom.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
}
function onRoomChanged(oldRoom, newRoom) {
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Entry) {
- newRoom.markAllMessagesAsRead();
+ newRoom.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
}
}
@@ -202,7 +202,7 @@ QQC2.ScrollView {
if (closeToYEnd && _private.hasScrolledUpBefore) {
if (QQC2.ApplicationWindow.window && (QQC2.ApplicationWindow.window.visibility !== QQC2.ApplicationWindow.Hidden)) {
- _private.room.markAllMessagesAsRead();
+ _private.room.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
_private.hasScrolledUpBefore = false;
} else if (!closeToYEnd) {
@@ -298,7 +298,7 @@ QQC2.ScrollView {
onClicked: {
messageListView.positionViewAtBeginning();
- _private.room.markAllMessagesAsRead();
+ _private.room.markAllMessagesAsRead(NeoChatConfig.publicReadReceipts);
}
icon.name: "go-down"