parent
24724453dd
commit
4e2c2e58a8
2 changed files with 25 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
|||
v-on:addreaction="addReaction"
|
||||
v-on:addreply="addReply(selectedEvent)"
|
||||
v-on:edit="edit(selectedEvent)"
|
||||
v-on:redact="redact(selectedEvent)"
|
||||
v-on:download="download(selectedEvent)"
|
||||
:event="selectedEvent"
|
||||
:incoming="selectedEvent.getSender() != $matrix.currentUserId"
|
||||
|
|
@ -823,6 +824,16 @@ export default {
|
|||
this.$refs.messageInput.focus();
|
||||
},
|
||||
|
||||
redact(event) {
|
||||
this.$matrix.matrixClient.redactEvent(event.getRoomId(), event.getId())
|
||||
.then(() => {
|
||||
console.log("Message redacted");
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("Redaction failed: ", err);
|
||||
})
|
||||
},
|
||||
|
||||
download(event) {
|
||||
util
|
||||
.getAttachment(this.$matrix.matrixClient, event)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<v-btn v-if="isEditable" icon @click.stop="edit" class="ma-0 pa-0">
|
||||
<v-icon>edit</v-icon>
|
||||
</v-btn>
|
||||
<v-btn v-if="isRedactable" icon @click.stop="redact" class="ma-0 pa-0">
|
||||
<v-icon>delete</v-icon>
|
||||
</v-btn>
|
||||
<v-btn v-if="isDownloadable" icon @click.stop="download" class="ma-0 pa-0">
|
||||
<v-icon>get_app</v-icon>
|
||||
</v-btn>
|
||||
|
|
@ -43,6 +46,13 @@ export default {
|
|||
isDownloadable() {
|
||||
const msgtype = this.event.getContent().msgtype;
|
||||
return ['m.video','m.audio','m.image','m.file'].includes(msgtype);
|
||||
},
|
||||
isRedactable() {
|
||||
const room = this.$matrix.matrixClient.getRoom(this.event.getRoomId());
|
||||
if (room && room.currentState && room.currentState.maySendRedactionForEvent(this.event, this.$matrix.currentUserId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -59,6 +69,10 @@ export default {
|
|||
this.$emit("close");
|
||||
this.$emit("edit", {event:this.event});
|
||||
},
|
||||
redact() {
|
||||
this.$emit("close");
|
||||
this.$emit("redact", {event:this.event});
|
||||
},
|
||||
download() {
|
||||
this.$emit("close");
|
||||
this.$emit("download", {event:this.event});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue