Purge room work

For issue #118. Now with better status and error. Also, make sure to set global flag "no warning for unknown devices" while we are redacting events.
This commit is contained in:
N-Pex 2021-05-27 13:38:57 +02:00
parent e9a1633083
commit 86f03c0fc2
4 changed files with 44 additions and 10 deletions

View file

@ -3,9 +3,12 @@
<div class="dialog-content text-center">
<template>
<v-icon color="black" size="30">lock</v-icon>
<h2 class="dialog-title">{{$t('purge_room.title')}}</h2>
<h2 class="dialog-title">{{ $t("purge_room.title") }}</h2>
<div class="dialog-text">
{{$t('purge_room.info')}}
{{ $t("purge_room.info") }}
</div>
<div class="dialog-text">
{{ status }}
</div>
</template>
<v-container fluid>
@ -16,8 +19,9 @@
text
block
class="text-button"
:disabled="isPurging"
@click="showDialog = false"
>{{$t('menu.cancel')}}</v-btn
>{{ $t("menu.cancel") }}</v-btn
>
</v-col>
<v-col cols="6" align="center">
@ -26,8 +30,9 @@
depressed
block
class="filled-button"
:disabled="isPurging"
@click.stop="onPurgeRoom()"
>{{$t('purge_room.button')}}</v-btn
>{{ $t("purge_room.button") }}</v-btn
>
</v-col>
</v-row>
@ -52,6 +57,8 @@ export default {
data() {
return {
showDialog: false,
isPurging: false,
status: null,
};
},
watch: {
@ -69,8 +76,9 @@ export default {
methods: {
onPurgeRoom() {
this.isPurging = true;
this.$matrix
.purgeRoom(this.room.roomId)
.purgeRoom(this.room.roomId, this.onPurgeStatus)
.then(() => {
this.showDialog = false;
console.log("Purged room");
@ -78,8 +86,16 @@ export default {
})
.catch((err) => {
console.error("Error purging", err);
this.status = this.$t("room.purge_failed");
})
.finally(() => {
this.isPurging = false;
});
},
onPurgeStatus(message) {
this.status = message;
},
},
};
</script>