Skip to content

Commit

Permalink
fixup! feat: mail filters
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Mahjoubi <[email protected]>
  • Loading branch information
hamza221 committed Sep 18, 2024
1 parent 8c964c2 commit 98320f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
9 changes: 4 additions & 5 deletions src/components/mailFilter/MailFilterDeleteModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
-->
<template>
<NcDialog :name="t('mail','Delete mail filter {filterName}?', {filterName: filter.name})"
:open="open"
:message="t('mail', 'Are you sure to delete the mail filter?')"
:buttons="buttons"
@close="closeModal()" />
@closing="closeModal()" />
</template>

<script>
Expand All @@ -17,18 +18,16 @@ import IconCheck from '@mdi/svg/svg/check.svg'
export default {
name: 'MailFilterDeleteModal',
components: {
IconCancel,
IconCheck,
NcDialog,
},
props: {
filter: {
type: Object,
required: true,
},
loading: {
open: {
type: Boolean,
required: false,
required: true,
},
},
data() {
Expand Down
5 changes: 1 addition & 4 deletions src/components/mailFilter/MailFilterTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,12 @@
</div>
</template>
<script>
import { NcActionButton, NcActions, NcButton, NcLoadingIcon, NcSelect } from '@nextcloud/vue'
import { NcButton, NcSelect } from '@nextcloud/vue'
import DeleteIcon from 'vue-material-design-icons/Delete.vue'

export default {
name: 'MailFilterTest',
components: {
NcLoadingIcon,
NcActions,
NcActionButton,
NcButton,
NcSelect,
DeleteIcon,
Expand Down
14 changes: 8 additions & 6 deletions src/components/mailFilter/MailFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@
:loading="loading"
@update-filter="updateFilter"
@close="closeModal" />
<MailFilterDeleteModal v-if="showDeleteModal && currentFilter"
<MailFilterDeleteModal v-if="currentFilter"
:filter="currentFilter"
:open="showDeleteModal"
:loading="loading"
@delete-filter="deleteFilter"
@close="closeModal" />
</div>
</template>

<script>
import { NcLoadingIcon as IconLoading, NcActionButton, NcListItem, NcButton } from '@nextcloud/vue'
import { NcActionButton, NcListItem, NcButton } from '@nextcloud/vue'
import MailFilterUpdateModal from './MailFilterUpdateModal.vue'
import { randomId } from '../../util/randomId.js'
import logger from '../../logger.js'
Expand All @@ -59,7 +60,6 @@ export default {
name: 'MailFilters',
components: {
NcButton,
IconLoading,
NcListItem,
NcActionButton,
MailFilterUpdateModal,
Expand Down Expand Up @@ -173,16 +173,18 @@ export default {
})

try {
await this.mailFilterStore.update(this.account.id)
await this.mailFilterStore.update(this.account.id).then(() => {
showSuccess(t('mail', 'Filter deleted'))
})
} catch (e) {
// TODO error toast
logger.error(e)
showError(t('mail', 'Could not delete filter'))
} finally {
this.loading = false
}

await this.$store.dispatch('fetchActiveSieveScript', { accountId: this.account.id })

this.closeModal()
},
closeModal() {
this.showUpdateModal = false
Expand Down

0 comments on commit 98320f1

Please sign in to comment.