Allow redaction of message only by admins and authors of the message
Previously you could click on the button but it would do nothing
This commit is contained in:
@@ -21,6 +21,7 @@ import NeoChat.Effect 1.0
|
|||||||
|
|
||||||
Control {
|
Control {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
Audio {
|
Audio {
|
||||||
@@ -32,7 +33,7 @@ Control {
|
|||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
id: saveFileAction
|
id: saveFileAction
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let contextMenu = fileDelegateContextMenu.createObject(root)
|
let contextMenu = fileDelegateContextMenu.createObject(root, {'room': currentRoom, 'author': author});
|
||||||
contextMenu.viewSource.connect(function() {
|
contextMenu.viewSource.connect(function() {
|
||||||
messagerSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
messagerSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ RowLayout {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var contextMenu = fileDelegateContextMenu.createObject(root)
|
var contextMenu = fileDelegateContextMenu.createObject(root, {'room': currentRoom, 'author': author});
|
||||||
contextMenu.viewSource.connect(function() {
|
contextMenu.viewSource.connect(function() {
|
||||||
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ Image {
|
|||||||
onPrimaryClicked: fullScreenImage.createObject(parent, {"filename": eventId, "localPath": currentRoom.urlToDownload(eventId)}).showFullScreen()
|
onPrimaryClicked: fullScreenImage.createObject(parent, {"filename": eventId, "localPath": currentRoom.urlToDownload(eventId)}).showFullScreen()
|
||||||
|
|
||||||
onSecondaryClicked: {
|
onSecondaryClicked: {
|
||||||
var contextMenu = imageDelegateContextMenu.createObject(root)
|
var contextMenu = imageDelegateContextMenu.createObject(root, {'room': currentRoom});
|
||||||
contextMenu.viewSource.connect(function() {
|
contextMenu.viewSource.connect(function() {
|
||||||
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ Video {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSecondaryClicked: {
|
onSecondaryClicked: {
|
||||||
var contextMenu = imageDelegateContextMenu.createObject(vid)
|
var contextMenu = imageDelegateContextMenu.createObject(vid, {'room': currentRoom, 'author': author})
|
||||||
contextMenu.viewSource.connect(function() {
|
contextMenu.viewSource.connect(function() {
|
||||||
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,14 +9,17 @@ import QtQuick.Controls 2.12
|
|||||||
import NeoChat.Dialog 1.0
|
import NeoChat.Dialog 1.0
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property var room
|
||||||
|
required property var author
|
||||||
|
|
||||||
signal viewSource()
|
signal viewSource()
|
||||||
signal downloadAndOpen()
|
signal downloadAndOpen()
|
||||||
signal saveFileAs()
|
signal saveFileAs()
|
||||||
signal reply()
|
signal reply()
|
||||||
signal redact()
|
signal redact()
|
||||||
|
|
||||||
id: root
|
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: i18n("View Source")
|
text: i18n("View Source")
|
||||||
|
|
||||||
@@ -42,8 +45,8 @@ Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
|
visible: room.canSendState("redact") || room.localUser.id === author.id
|
||||||
text: i18n("Redact")
|
text: i18n("Redact")
|
||||||
|
|
||||||
onTriggered: redact()
|
onTriggered: redact()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ Kirigami.OverlaySheet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
Kirigami.BasicListItem {
|
||||||
|
visible: author.id === currentRoom.localUser.id || currentRoom.canSendState("redact")
|
||||||
action: Kirigami.Action {
|
action: Kirigami.Action {
|
||||||
text: i18n("Remove")
|
text: i18n("Remove")
|
||||||
icon.name: "edit-delete-remove"
|
icon.name: "edit-delete-remove"
|
||||||
|
|||||||
Reference in New Issue
Block a user