2018-04-05 04:45:19 +00:00
|
|
|
<ModalDialog
|
2018-05-02 00:05:36 +00:00
|
|
|
{id}
|
|
|
|
{label}
|
|
|
|
{title}
|
2018-04-05 04:45:19 +00:00
|
|
|
background="var(--main-bg)"
|
|
|
|
>
|
2018-08-18 05:26:08 +00:00
|
|
|
<GenericDialogList selectable={false} {items} on:click="onClick(event)"/>
|
2018-04-05 04:45:19 +00:00
|
|
|
</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-08-26 23:40:48 +00:00
|
|
|
import { importShowComposeDialog } from '../asyncDialogs'
|
2018-04-08 23:56:20 +00:00
|
|
|
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-15 05:18:48 +00:00
|
|
|
import { setAccountMuted } from '../../../_actions/mute'
|
|
|
|
import { setAccountFollowed } from '../../../_actions/follow'
|
2018-08-26 05:03:33 +00:00
|
|
|
import { setShowReblogs } from '../../../_actions/setShowReblogs'
|
2018-08-26 21:16:00 +00:00
|
|
|
import { setDomainBlocked } from '../../../_actions/setDomainBlocked'
|
2018-08-26 23:40:48 +00:00
|
|
|
import { copyText } from '../../../_actions/copyText'
|
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-05-12 22:00:11 +00:00
|
|
|
//
|
|
|
|
// begin copypasta (StatusOptionsDialog.html / AccountProfileOptionsDialog.html)
|
|
|
|
//
|
2018-05-02 00:05:36 +00:00
|
|
|
verifyCredentialsId: ({ verifyCredentials }) => verifyCredentials.id,
|
|
|
|
following: ({ relationship }) => relationship && relationship.following,
|
|
|
|
followRequested: ({ relationship }) => relationship && relationship.requested,
|
|
|
|
accountId: ({ account }) => account && account.id,
|
|
|
|
acct: ({ account }) => account.acct,
|
|
|
|
muting: ({ relationship }) => relationship.muting,
|
|
|
|
blocking: ({ relationship }) => relationship.blocking,
|
|
|
|
followLabel: ({ following, followRequested, account, acct }) => {
|
2018-04-15 05:18:48 +00:00
|
|
|
if (typeof following === 'undefined' || !account) {
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
return (following || followRequested)
|
|
|
|
? `Unfollow @${acct}`
|
|
|
|
: `Follow @${acct}`
|
|
|
|
},
|
2018-05-12 22:00:11 +00:00
|
|
|
followIcon: ({ following, followRequested }) => (
|
|
|
|
following ? '#fa-user-times' : followRequested ? '#fa-hourglass' : '#fa-user-plus'
|
|
|
|
),
|
|
|
|
blockLabel: ({ blocking, acct }) => (
|
|
|
|
blocking ? `Unblock @${acct}` : `Block @${acct}`
|
|
|
|
),
|
2018-05-02 00:05:36 +00:00
|
|
|
blockIcon: ({ blocking }) => blocking ? '#fa-unlock' : '#fa-ban',
|
2018-05-12 22:00:11 +00:00
|
|
|
muteLabel: ({ muting, acct }) => (
|
|
|
|
muting ? `Unmute @${acct}` : `Mute @${acct}`
|
|
|
|
),
|
2018-05-02 00:05:36 +00:00
|
|
|
muteIcon: ({ muting }) => muting ? '#fa-volume-up' : '#fa-volume-off',
|
2018-05-12 22:00:11 +00:00
|
|
|
isUser: ({ accountId, verifyCredentialsId }) => accountId === verifyCredentialsId,
|
|
|
|
//
|
|
|
|
// end copypasta (StatusOptionsDialog.html / AccountProfileOptionsDialog.html)
|
|
|
|
//
|
2018-08-26 05:03:33 +00:00
|
|
|
showingReblogs: ({ relationship }) => !!relationship.showing_reblogs,
|
|
|
|
showReblogsLabel: ({ showingReblogs, acct }) => (
|
|
|
|
showingReblogs
|
|
|
|
? `Hide boosts from @${acct}`
|
|
|
|
: `Show boosts from @${acct}`
|
|
|
|
),
|
2018-08-26 21:16:00 +00:00
|
|
|
domain: ({ acct }) => acct.split('@')[1],
|
|
|
|
blockingDomain: ({ relationship }) => !!relationship.domain_blocking,
|
|
|
|
blockDomainLabel: ({ blockingDomain, domain }) => (
|
|
|
|
blockingDomain
|
|
|
|
? `Unhide ${domain}`
|
|
|
|
: `Hide ${domain}`
|
|
|
|
),
|
2018-05-12 22:00:11 +00:00
|
|
|
items: ({
|
|
|
|
blockLabel, blocking, blockIcon, muteLabel, muteIcon,
|
2018-04-20 04:38:01 +00:00
|
|
|
followLabel, followIcon, following, followRequested,
|
2018-08-26 21:16:00 +00:00
|
|
|
accountId, verifyCredentialsId, acct, isUser, showReblogsLabel,
|
|
|
|
domain, blockDomainLabel
|
2018-05-12 22:00:11 +00:00
|
|
|
}) => ([
|
|
|
|
!isUser && {
|
|
|
|
key: 'mention',
|
|
|
|
label: `Mention @${acct}`,
|
|
|
|
icon: '#fa-comments'
|
|
|
|
},
|
|
|
|
!isUser && !blocking && {
|
|
|
|
key: 'follow',
|
|
|
|
label: followLabel,
|
|
|
|
icon: followIcon
|
|
|
|
},
|
|
|
|
!isUser && {
|
|
|
|
key: 'block',
|
|
|
|
label: blockLabel,
|
|
|
|
icon: blockIcon
|
|
|
|
},
|
|
|
|
!isUser && !blocking && {
|
|
|
|
key: 'mute',
|
|
|
|
label: muteLabel,
|
|
|
|
icon: muteIcon
|
|
|
|
},
|
2018-08-26 05:03:33 +00:00
|
|
|
!isUser && following && {
|
|
|
|
key: 'showReblogs',
|
|
|
|
label: showReblogsLabel,
|
|
|
|
icon: '#fa-retweet'
|
|
|
|
},
|
2018-08-26 21:16:00 +00:00
|
|
|
!isUser && domain && {
|
|
|
|
key: 'blockDomain',
|
|
|
|
label: blockDomainLabel,
|
|
|
|
icon: '#fa-ban'
|
|
|
|
},
|
2018-05-12 22:00:11 +00:00
|
|
|
{
|
|
|
|
key: 'copy',
|
|
|
|
label: 'Copy link to account',
|
2018-05-27 00:23:27 +00:00
|
|
|
icon: '#fa-link'
|
2018-05-12 22:00:11 +00:00
|
|
|
}
|
|
|
|
].filter(Boolean))
|
2018-04-05 04:45:19 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2018-04-08 23:56:20 +00:00
|
|
|
show,
|
|
|
|
close,
|
2018-04-20 04:38:01 +00:00
|
|
|
onClick (item) {
|
2018-04-15 01:47:55 +00:00
|
|
|
switch (item.key) {
|
|
|
|
case 'mention':
|
|
|
|
return this.onMentionClicked()
|
2018-04-15 05:18:48 +00:00
|
|
|
case 'follow':
|
|
|
|
return this.onFollowClicked()
|
2018-04-15 01:47:55 +00:00
|
|
|
case 'block':
|
|
|
|
return this.onBlockClicked()
|
2018-04-15 05:18:48 +00:00
|
|
|
case 'mute':
|
|
|
|
return this.onMuteClicked()
|
2018-08-26 05:03:33 +00:00
|
|
|
case 'showReblogs':
|
|
|
|
return this.onShowReblogsClicked()
|
2018-08-26 21:16:00 +00:00
|
|
|
case 'blockDomain':
|
|
|
|
return this.onBlockDomainClicked()
|
|
|
|
case 'copy':
|
|
|
|
return this.onCopyClicked()
|
2018-04-15 01:47:55 +00:00
|
|
|
}
|
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
async onMentionClicked () {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { acct } = this.get()
|
2018-04-07 07:21:00 +00:00
|
|
|
this.store.setComposeData('dialog', {
|
2018-04-15 05:18:48 +00:00
|
|
|
text: `@${acct} `
|
2018-04-05 04:45:19 +00:00
|
|
|
})
|
2018-04-21 16:56:53 +00:00
|
|
|
let showComposeDialog = await importShowComposeDialog()
|
|
|
|
showComposeDialog()
|
2018-04-08 23:56:20 +00:00
|
|
|
this.close()
|
2018-04-15 01:47:55 +00:00
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
async onFollowClicked () {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { accountId, following } = this.get()
|
2018-04-15 05:18:48 +00:00
|
|
|
this.close()
|
|
|
|
await setAccountFollowed(accountId, !following, true)
|
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
async onBlockClicked () {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { accountId, blocking } = this.get()
|
2018-04-15 01:47:55 +00:00
|
|
|
this.close()
|
|
|
|
await setAccountBlocked(accountId, !blocking, true)
|
2018-04-15 05:18:48 +00:00
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
async onMuteClicked () {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { accountId, muting } = this.get()
|
2018-04-15 05:18:48 +00:00
|
|
|
this.close()
|
|
|
|
await setAccountMuted(accountId, !muting, true)
|
2018-05-12 22:00:11 +00:00
|
|
|
},
|
2018-08-26 05:03:33 +00:00
|
|
|
async onShowReblogsClicked () {
|
|
|
|
let { accountId, showingReblogs } = this.get()
|
|
|
|
this.close()
|
|
|
|
await setShowReblogs(accountId, !showingReblogs, true)
|
|
|
|
},
|
2018-08-26 21:16:00 +00:00
|
|
|
async onBlockDomainClicked () {
|
|
|
|
let { accountId, domain, blockingDomain } = this.get()
|
|
|
|
this.close()
|
|
|
|
await setDomainBlocked(accountId, domain, !blockingDomain, true)
|
|
|
|
},
|
2018-05-12 22:00:11 +00:00
|
|
|
async onCopyClicked () {
|
|
|
|
let { account } = this.get()
|
|
|
|
let { url } = account
|
2018-08-26 23:40:48 +00:00
|
|
|
this.close()
|
|
|
|
await copyText(url)
|
2018-04-05 04:45:19 +00:00
|
|
|
}
|
2018-04-08 23:56:20 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
ModalDialog,
|
|
|
|
GenericDialogList
|
2018-04-20 04:38:01 +00:00
|
|
|
}
|
2018-04-05 04:45:19 +00:00
|
|
|
}
|
|
|
|
</script>
|