Add custom state event for "room deleted"

This commit is contained in:
N-Pex 2023-09-29 10:28:33 +02:00
parent 9e8ac6ad67
commit 876b79bee6
4 changed files with 44 additions and 8 deletions

View file

@ -1,4 +1,4 @@
import util from "../plugins/utils";
import util, { STATE_EVENT_ROOM_DELETION_NOTICE } from "../plugins/utils";
import MessageIncomingText from "./messages/MessageIncomingText";
import MessageIncomingFile from "./messages/MessageIncomingFile";
import MessageIncomingImage from "./messages/MessageIncomingImage.vue";
@ -296,9 +296,9 @@ export default {
return MessageOutgoingPoll;
}
case "im.keanu.room_deletion_notice": {
case STATE_EVENT_ROOM_DELETION_NOTICE: {
// Custom event for notice 30 seconds before a room is deleted/purged.
const deletionNotices = this.room.currentState.getStateEvents("im.keanu.room_deletion_notice");
const deletionNotices = this.room.currentState.getStateEvents(STATE_EVENT_ROOM_DELETION_NOTICE);
if (deletionNotices && deletionNotices.length > 0 && deletionNotices[deletionNotices.length - 1] == event) {
// This is the latest/last one. Look at the status flag. Show nothing if it is "cancel".
if (event.getContent().status != "cancel") {