Page MenuHomePhorge

D87.1732641708.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D87.1732641708.diff

diff --git a/src/contents/ui/room-settings/RoomMemberListPage.qml b/src/contents/ui/room-settings/RoomMemberListPage.qml
--- a/src/contents/ui/room-settings/RoomMemberListPage.qml
+++ b/src/contents/ui/room-settings/RoomMemberListPage.qml
@@ -29,4 +29,6 @@
room: roomSettingsPage.room
members: roomSettingsPage.members
}
+
+ Component.onCompleted: room.refreshState()
}
diff --git a/src/matrix-room.hpp b/src/matrix-room.hpp
--- a/src/matrix-room.hpp
+++ b/src/matrix-room.hpp
@@ -118,6 +118,8 @@
Q_INVOKABLE MatrixPromise *ensureStateEvent(const QString &type, const QString &stateKey) const;
+ Q_INVOKABLE MatrixPromise *refreshState() const;
+
Q_INVOKABLE MatrixPromise *kickUser(const QString &userId, const QString &reason) const;
Q_INVOKABLE MatrixPromise *banUser(const QString &userId, const QString &reason = "") const;
diff --git a/src/matrix-room.cpp b/src/matrix-room.cpp
--- a/src/matrix-room.cpp
+++ b/src/matrix-room.cpp
@@ -459,6 +459,11 @@
}
}
+MatrixPromise *MatrixRoom::refreshState() const
+{
+ return new MatrixPromise(m_room.refreshRoomState());
+}
+
MatrixPromise *MatrixRoom::kickUser(const QString &userId, const QString &reason) const
{
return new MatrixPromise(m_room.kick(userId.toStdString(), reason.toStdString()));
diff --git a/src/tests/quick-tests/tst_RoomMemberListPage.qml b/src/tests/quick-tests/tst_RoomMemberListPage.qml
new file mode 100644
--- /dev/null
+++ b/src/tests/quick-tests/tst_RoomMemberListPage.qml
@@ -0,0 +1,52 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2023-2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick 2.15
+import QtQuick.Layouts 1.15
+import QtTest 1.0
+
+import '../../contents/ui' as Kazv
+import '../../contents/ui/room-settings' as RS
+import 'test-helpers.js' as Helpers
+import 'test-helpers' as TestHelpers
+
+import moe.kazv.mxc.kazv 0.0 as MK
+
+Item {
+ id: item
+ width: 800
+ height: 600
+
+ property var mockHelper: TestHelpers.MockHelper {}
+ property var room: QtObject {
+ property var refreshState: mockHelper.promise()
+ }
+ property var l10n: Helpers.fluentMock
+ property var matrixSdk: TestHelpers.MatrixSdkMock {
+ property var userId: '@foo:example.org'
+ }
+ property var sdkVars: ({})
+
+ property var pageComp: Component {
+ RS.RoomMemberListPage {
+ }
+ }
+
+ TestCase {
+ id: roomMemberListPageTest
+ name: 'RoomMemberListPageTest'
+ when: windowShown
+
+ function init() {
+ mockHelper.clearAll();
+ }
+
+ function test_loadState() {
+ const page = pageComp.createObject(item, { room, members: 0 });
+ tryVerify(() => room.refreshState.calledTimes());
+ }
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 9:21 AM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40597
Default Alt Text
D87.1732641708.diff (2 KB)

Event Timeline