Add custom state event for "room deleted"
This commit is contained in:
parent
9e8ac6ad67
commit
876b79bee6
4 changed files with 44 additions and 8 deletions
|
|
@ -91,6 +91,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import roomInfoMixin from "./roomInfoMixin";
|
||||
import { STATE_EVENT_ROOM_DELETION_NOTICE } from "../plugins/utils";
|
||||
|
||||
export default {
|
||||
name: "LeaveRoomDialog",
|
||||
|
|
@ -136,7 +137,7 @@ export default {
|
|||
// Cancel the state event for deletion
|
||||
this.$matrix.matrixClient.sendStateEvent(
|
||||
this.room.roomId,
|
||||
"im.keanu.room_deletion_notice",
|
||||
STATE_EVENT_ROOM_DELETION_NOTICE,
|
||||
{ status: "cancel" }
|
||||
);
|
||||
|
||||
|
|
@ -146,7 +147,7 @@ export default {
|
|||
// Send custom state event!
|
||||
this.$matrix.matrixClient.sendStateEvent(
|
||||
this.room.roomId,
|
||||
"im.keanu.room_deletion_notice",
|
||||
STATE_EVENT_ROOM_DELETION_NOTICE,
|
||||
{ status: "delete" }
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue