Page MenuHomePhorge

D197.1731646505.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D197.1731646505.diff

diff --git a/src/contents/ui/RoomListViewItemDelegate.qml b/src/contents/ui/RoomListViewItemDelegate.qml
--- a/src/contents/ui/RoomListViewItemDelegate.qml
+++ b/src/contents/ui/RoomListViewItemDelegate.qml
@@ -49,6 +49,16 @@
name: Helpers.roomAvatarPlaceholderName(item)
}
+ Label {
+ objectName: 'tombstoneIndicator'
+ visible: item.tombstoned === true
+ text: l10n.get('room-list-view-room-item-tombstone')
+ background: Rectangle {
+ color: Kirigami.Theme.negativeBackgroundColor
+ }
+ color: Kirigami.Theme.negativeTextColor
+ }
+
Label {
objectName: 'inviteIndicator'
visible: item.membership === MK.MatrixRoom.Invite
diff --git a/src/l10n/cmn-Hans/100-ui.ftl b/src/l10n/cmn-Hans/100-ui.ftl
--- a/src/l10n/cmn-Hans/100-ui.ftl
+++ b/src/l10n/cmn-Hans/100-ui.ftl
@@ -90,6 +90,7 @@
room-list-view-room-item-more-action = 更多...
room-list-view-room-item-invited = (邀请)
room-list-view-room-item-left = (已离开)
+room-list-view-room-item-tombstone = (已废弃)
room-settings-action = 房间设置...
room-settings-page-title = { $room } 的房间设置
diff --git a/src/l10n/en/100-ui.ftl b/src/l10n/en/100-ui.ftl
--- a/src/l10n/en/100-ui.ftl
+++ b/src/l10n/en/100-ui.ftl
@@ -94,6 +94,7 @@
room-list-view-room-item-more-action = More...
room-list-view-room-item-invited = (Invited)
room-list-view-room-item-left = (Left)
+room-list-view-room-item-tombstone = (Deprecated)
room-settings-action = Room settings...
room-settings-page-title = Room settings for { $room }
diff --git a/src/matrix-room.hpp b/src/matrix-room.hpp
--- a/src/matrix-room.hpp
+++ b/src/matrix-room.hpp
@@ -61,6 +61,7 @@
LAGER_QT_READER(QString, roomOrHeroAvatarMxcUri);
LAGER_QT_READER(QString, localDraft);
LAGER_QT_READER(bool, encrypted);
+ LAGER_QT_READER(bool, tombstoned);
LAGER_QT_READER(QStringList, memberNames);
LAGER_QT_READER(QStringList, tagIds);
diff --git a/src/matrix-room.cpp b/src/matrix-room.cpp
--- a/src/matrix-room.cpp
+++ b/src/matrix-room.cpp
@@ -6,6 +6,8 @@
#include <kazv-defs.hpp>
+#include <string>
+
#include <lager/setter.hpp>
#include <nlohmann/json.hpp>
#include <event.hpp>
@@ -30,6 +32,7 @@
using namespace Qt::Literals::StringLiterals;
using namespace Kazv;
+using namespace std::string_literals;
static const int typingDebounceMs = 500;
static const int saveDraftDebounceMs = 5000;
@@ -71,6 +74,8 @@
.xform(strToQt))
, LAGER_QT(localDraft)(m_room.localDraft().xform(strToQt))
, LAGER_QT(encrypted)(m_room.encrypted())
+ , LAGER_QT(tombstoned)(m_room.stateOpt({"m.room.tombstone"s, ""s}).map(
+ [](auto c) { return c.has_value(); }))
, LAGER_QT(memberNames)(m_memberNames.xform(strListToQt))
, LAGER_QT(tagIds)(m_room.tags().map([](const auto &tagsMap) {
return zug::into(
diff --git a/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml b/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml
--- a/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml
+++ b/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml
@@ -20,6 +20,7 @@
property var roomInvite: JsHelpers.factory.room({
membership: MK.MatrixRoom.Invite,
unreadNotificationCount: 0,
+ tombstoned: true,
})
property var roomJoin: JsHelpers.factory.room({
@@ -37,6 +38,11 @@
unreadNotificationCount: 2,
})
+ property var roomTombstone: JsHelpers.factory.room({
+ tombstoned: true,
+ unreadNotificationCount: 0,
+ })
+
property var timelineUnread: QtObject {
property var count: 5
function at(i) {
@@ -202,6 +208,11 @@
},
})
}
+
+ Kazv.RoomListViewItemDelegate {
+ id: delegateTombstone
+ item: roomTombstone
+ }
}
TestCase {
@@ -284,5 +295,15 @@
verify(findChild(delegateUnread, 'unreadIndicator').visible);
verify(!findChild(delegateUnread, 'unreadNotificationCount').visible);
}
+
+ function test_tombstoneIndictor() {
+ const indicator = findChild(delegateTombstone, 'tombstoneIndicator');
+ verify(indicator);
+ verify(indicator.visible);
+
+ const indicatorJoin = findChild(delegateJoin, 'tombstoneIndicator');
+ verify(indicatorJoin);
+ verify(!indicatorJoin.visible);
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 14, 8:55 PM (6 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37380
Default Alt Text
D197.1731646505.diff (4 KB)

Event Timeline