2018-04-05 05:33:17 +02:00
|
|
|
<ModalDialog
|
2018-05-02 02:05:36 +02:00
|
|
|
{id}
|
|
|
|
{label}
|
|
|
|
{title}
|
2018-04-05 05:33:17 +02:00
|
|
|
background="var(--main-bg)"
|
|
|
|
>
|
2018-08-18 07:26:08 +02:00
|
|
|
<GenericDialogList selectable={true} {items} on:click="onClick(event)" />
|
2018-03-03 22:23:26 +01:00
|
|
|
</ModalDialog>
|
|
|
|
<script>
|
|
|
|
import ModalDialog from './ModalDialog.html'
|
2018-04-09 01:56:20 +02:00
|
|
|
import { store } from '../../../_store/store'
|
|
|
|
import { POST_PRIVACY_OPTIONS } from '../../../_static/statuses'
|
|
|
|
import { setPostPrivacy } from '../../../_actions/postPrivacy'
|
2018-03-12 03:40:32 +01:00
|
|
|
import GenericDialogList from './GenericDialogList.html'
|
2018-04-09 01:56:20 +02:00
|
|
|
import { show } from '../helpers/showDialog'
|
|
|
|
import { close } from '../helpers/closeDialog'
|
|
|
|
import { oncreate } from '../helpers/onCreateDialog'
|
2018-03-03 22:23:26 +01:00
|
|
|
|
|
|
|
export default {
|
2018-04-09 01:56:20 +02:00
|
|
|
oncreate,
|
2018-03-03 22:23:26 +01:00
|
|
|
components: {
|
2018-03-12 03:40:32 +01:00
|
|
|
ModalDialog,
|
|
|
|
GenericDialogList
|
2018-03-03 22:23:26 +01:00
|
|
|
},
|
|
|
|
store: () => store,
|
|
|
|
data: () => ({
|
|
|
|
postPrivacyOptions: POST_PRIVACY_OPTIONS
|
|
|
|
}),
|
|
|
|
methods: {
|
2018-04-09 01:56:20 +02:00
|
|
|
show,
|
|
|
|
close,
|
2018-04-20 06:38:01 +02:00
|
|
|
onClick (item) {
|
2018-04-19 18:37:05 +02:00
|
|
|
let { realm } = this.get()
|
|
|
|
setPostPrivacy(realm, item.key)
|
2018-04-09 01:56:20 +02:00
|
|
|
this.close()
|
2018-03-03 22:23:26 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2018-05-02 02:05:36 +02:00
|
|
|
composeData: ({ $currentComposeData, realm }) => $currentComposeData[realm] || {},
|
|
|
|
postPrivacy: ({ postPrivacyKey }) => {
|
2018-03-03 22:23:26 +01:00
|
|
|
return POST_PRIVACY_OPTIONS.find(_ => _.key === postPrivacyKey)
|
|
|
|
},
|
2018-05-02 02:05:36 +02:00
|
|
|
postPrivacyKey: ({ composeData, $currentVerifyCredentials }) => {
|
2018-03-03 23:15:50 +01:00
|
|
|
return composeData.postPrivacy || $currentVerifyCredentials.source.privacy
|
2018-03-12 03:40:32 +01:00
|
|
|
},
|
2018-05-02 02:05:36 +02:00
|
|
|
items: ({ postPrivacy, postPrivacyOptions }) => {
|
2018-03-12 03:40:32 +01:00
|
|
|
return postPrivacyOptions.map(option => ({
|
|
|
|
key: option.key,
|
|
|
|
label: option.label,
|
|
|
|
icon: option.icon,
|
|
|
|
selected: postPrivacy.key === option.key
|
|
|
|
}))
|
2018-03-03 22:23:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|