2018-04-05 04:45:19 +00:00
|
|
|
<ModalDialog
|
2018-04-08 23:56:20 +00:00
|
|
|
:id
|
2018-04-05 04:45:19 +00:00
|
|
|
:label
|
|
|
|
:title
|
|
|
|
background="var(--main-bg)"
|
|
|
|
>
|
|
|
|
<GenericDialogList :items on:click="onClick(event)"/>
|
|
|
|
</ModalDialog>
|
|
|
|
<script>
|
|
|
|
import ModalDialog from './ModalDialog.html'
|
2018-04-08 23:56:20 +00:00
|
|
|
import { store } from '../../../_store/store'
|
2018-04-05 04:45:19 +00:00
|
|
|
import GenericDialogList from './GenericDialogList.html'
|
2018-04-08 23:56:20 +00:00
|
|
|
import { importDialogs } from '../../../_utils/asyncModules'
|
|
|
|
import { createDialogId } from '../helpers/createDialogId'
|
|
|
|
import { show } from '../helpers/showDialog'
|
|
|
|
import { close } from '../helpers/closeDialog'
|
|
|
|
import { oncreate } from '../helpers/onCreateDialog'
|
2018-04-15 01:47:55 +00:00
|
|
|
import { setAccountBlocked } from '../../../_actions/block'
|
2018-04-05 04:45:19 +00:00
|
|
|
|
|
|
|
export default {
|
2018-04-08 23:56:20 +00:00
|
|
|
oncreate,
|
|
|
|
store: () => store,
|
|
|
|
data: () => ({
|
|
|
|
id: createDialogId()
|
|
|
|
}),
|
2018-04-05 04:45:19 +00:00
|
|
|
computed: {
|
2018-04-15 01:47:55 +00:00
|
|
|
blocking: (relationship) => relationship && relationship.blocking,
|
|
|
|
items: (account, blocking) => (
|
2018-04-05 04:45:19 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
key: 'mention',
|
2018-04-15 01:47:55 +00:00
|
|
|
label: `Mention @${account.acct}`,
|
2018-04-05 04:45:19 +00:00
|
|
|
icon: '#fa-comments'
|
2018-04-15 01:47:55 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'block',
|
|
|
|
label: blocking ? `Unblock @${account.acct}` : `Block @${account.acct}`,
|
|
|
|
icon: blocking ? '#fa-unlock' : '#fa-ban'
|
2018-04-05 04:45:19 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
},
|
|
|
|
methods: {
|
2018-04-08 23:56:20 +00:00
|
|
|
show,
|
|
|
|
close,
|
2018-04-15 01:47:55 +00:00
|
|
|
onClick(item) {
|
|
|
|
switch (item.key) {
|
|
|
|
case 'mention':
|
|
|
|
return this.onMentionClicked()
|
|
|
|
case 'block':
|
|
|
|
return this.onBlockClicked()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async onMentionClicked() {
|
2018-04-05 04:45:19 +00:00
|
|
|
let account = this.get('account')
|
2018-04-07 07:21:00 +00:00
|
|
|
this.store.setComposeData('dialog', {
|
2018-04-05 04:45:19 +00:00
|
|
|
text: `@${account.acct} `
|
|
|
|
})
|
2018-04-07 07:21:00 +00:00
|
|
|
let dialogs = await importDialogs()
|
|
|
|
dialogs.showComposeDialog()
|
2018-04-08 23:56:20 +00:00
|
|
|
this.close()
|
2018-04-15 01:47:55 +00:00
|
|
|
},
|
|
|
|
async onBlockClicked() {
|
|
|
|
let account = this.get('account')
|
|
|
|
let blocking = this.get('blocking')
|
|
|
|
let accountId = account.id
|
|
|
|
this.close()
|
|
|
|
await setAccountBlocked(accountId, !blocking, true)
|
2018-04-05 04:45:19 +00:00
|
|
|
}
|
2018-04-08 23:56:20 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
ModalDialog,
|
|
|
|
GenericDialogList
|
|
|
|
},
|
2018-04-05 04:45:19 +00:00
|
|
|
}
|
|
|
|
</script>
|