-
Notifications
You must be signed in to change notification settings - Fork 269
/
Copy pathActionFileinto.vue
70 lines (64 loc) · 1.45 KB
/
ActionFileinto.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<NcSelect ref="select"
:value="mailbox"
:options="mailboxOptions"
:required="true"
:aria-label-combobox="t('mail','Select a mailbox')"
@input="onInput" />
</template>
<script>
import NcSelect from '@nextcloud/vue/components/NcSelect'
import { mailboxHasRights } from '../../util/acl.js'
import { mapStores } from 'pinia'
import useMainStore from '../../store/mainStore.js'
export default {
name: 'ActionFileinto',
components: {
NcSelect,
},
props: {
action: {
type: Object,
required: true,
},
account: {
type: Object,
required: true,
},
},
computed: {
...mapStores(useMainStore),
mailbox() {
return this.action.mailbox ?? undefined
},
mailboxOptions() {
const result = []
const topMailboxes = this.mainStore.getMailboxes(this.account.accountId)
.filter(mailbox => mailboxHasRights(mailbox, 'i'))
for (const mailbox of topMailboxes) {
result.push({
value: mailbox,
label: mailbox.displayName,
})
const subMailboxes = this.mainStore.getSubMailboxes(mailbox.databaseId)
for (const subMailbox of subMailboxes) {
result.push({
value: subMailbox,
label: ` > ${subMailbox.displayName}`,
})
}
}
return result
},
},
methods: {
onInput(value) {
this.$emit('update-action', { mailbox: value })
},
},
}
</script>