Page MenuHomePhorge

D125.1732289478.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D125.1732289478.diff

diff --git a/src/contents/ui/Bubble.qml b/src/contents/ui/Bubble.qml
--- a/src/contents/ui/Bubble.qml
+++ b/src/contents/ui/Bubble.qml
@@ -82,7 +82,7 @@
Kirigami.Action {
objectName: 'deleteMenuItem'
text: l10n.get('event-delete')
- onTriggered: eventView.redactSelf()
+ onTriggered: deleteEventRequested(eventView);
enabled: event && !event.redacted
},
Kirigami.Action {
diff --git a/src/contents/ui/RoomTimelineView.qml b/src/contents/ui/RoomTimelineView.qml
--- a/src/contents/ui/RoomTimelineView.qml
+++ b/src/contents/ui/RoomTimelineView.qml
@@ -22,6 +22,7 @@
signal pinEventRequested(string eventId)
signal unpinEventRequested(string eventId)
+ signal deleteEventRequested(eventView: var)
property var pinEvent: Kazv.AsyncHandler {
property var eventIds
@@ -55,6 +56,10 @@
unpinEventPopupComp.createObject(Overlay.overlay, { eventId }).open()
}
+ onDeleteEventRequested: (eventView) => {
+ confirmDeletionPopupComp.createObject(Overlay.overlay, { eventView }).open()
+ }
+
property var pinEventPopupComp: Component {
Kazv.ConfirmationOverlay {
objectName: 'pinEventPopup'
@@ -99,6 +104,25 @@
}
}
+ property var confirmDeletionPopupComp: Component {
+ Kazv.ConfirmationOverlay {
+ objectName: 'confirmDeletionPopup'
+ property var eventView
+ shouldSelfDestroy: true
+ title: l10n.get('confirm-deletion-popup-title')
+ message: l10n.get('confirm-deletion-popup-message')
+ confirmActionText: l10n.get('confirm-deletion-popup-confirm-action')
+ cancelActionText: l10n.get('confirm-deletion-popup-cancel-action')
+
+ onAccepted: eventView.redactSelf()
+ EventViewWrapper {
+ Layout.fillWidth: true
+ event: room.messageById(eventView.event.eventId)
+ compactMode: true
+ }
+ }
+ }
+
spacing: 0
model: timeline
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
@@ -352,3 +352,8 @@
confirm-logout-popup-prompt = 你确定要登出吗?
confirm-logout-popup-accept-button = 是
confirm-logout-popup-cancel-button = 取消
+
+confirm-deletion-popup-title = 删除事件
+confirm-deletion-popup-message = 你确定要删除这个事件吗?
+confirm-deletion-popup-confirm-action = 删除
+confirm-deletion-popup-cancel-action = 取消
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
@@ -380,3 +380,8 @@
confirm-logout-popup-prompt = Are you sure to logout?
confirm-logout-popup-accept-button = Yes
confirm-logout-popup-cancel-button = Cancel
+
+confirm-deletion-popup-title = Delete event
+confirm-deletion-popup-message = Are you sure you want to delete this event?
+confirm-deletion-popup-confirm-action = Delete
+confirm-deletion-popup-cancel-action = Cancel
diff --git a/src/tests/quick-tests/tst_EventView.qml b/src/tests/quick-tests/tst_EventView.qml
--- a/src/tests/quick-tests/tst_EventView.qml
+++ b/src/tests/quick-tests/tst_EventView.qml
@@ -26,6 +26,7 @@
property var viewEventHistoryRequested: mockHelper.noop()
property var pinEventRequested: mockHelper.noop()
property var unpinEventRequested: mockHelper.noop()
+ property var deleteEventRequested: mockHelper.noop()
property var timeline: ({
gaps: [],
@@ -497,11 +498,9 @@
const menuComp = findChild(eventViewFailed, 'bubble').menuComp;
const menu = menuComp.createObject(menuComp.parent);
const deleteAction = findChild(menu, 'deleteMenuItem');
+ verify(deleteAction.enabled);
deleteAction.trigger();
-
- tryVerify(() => item.room.removeLocalEcho.calledTimes() === 1);
- tryVerify(() => item.room.removeLocalEcho.lastArgs()[0] === 'some-txn-id');
- verify(item.room.resendMessage.calledTimes() === 0);
+ compare(deleteEventRequested.calledTimes(), 1);
}
function test_sentMessage() {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 7:31 AM (5 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38895
Default Alt Text
D125.1732289478.diff (3 KB)

Event Timeline