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