refs #1453 Add quote button on toot

This commit is contained in:
AkiraFukushima 2020-08-21 11:20:43 +09:00
parent d1bff25216
commit 654cf60e58
3 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,3 @@
const QuoteSupportMastodon: Array<string> = ['fedibird.com']
export { QuoteSupportMastodon }

View File

@ -167,6 +167,9 @@
<span class="count">
{{ favouritesCount }}
</span>
<el-button type="text" class="quote-btn" v-if="quoteSupported">
<icon name="quote-right" scale="0.9"></icon>
</el-button>
<template v-if="sns !== 'mastodon'">
<el-button class="emoji" type="text" @click="toggleEmojiPicker">
<icon name="regular/smile" scale="0.9"></icon>
@ -242,6 +245,7 @@ import Poll from '~/src/renderer/components/molecules/Toot/Poll'
import LinkPreview from '~/src/renderer/components/molecules/Toot/LinkPreview'
import Quote from '@/components/molecules/Toot/Quote'
import { setInterval, clearInterval } from 'timers'
import QuoteSupported from '@/utils/quoteSupported'
export default {
name: 'toot',
@ -298,7 +302,8 @@ export default {
language: state => state.language
}),
...mapState('TimelineSpace', {
sns: state => state.sns
sns: state => state.sns,
account: state => state.account
}),
shortcutEnabled: function () {
return this.focused && !this.overlaid && !this.openEmojiPicker
@ -369,6 +374,9 @@ export default {
},
directed: function () {
return this.message.visibility === 'direct'
},
quoteSupported: function () {
return QuoteSupported(this.sns, this.account)
}
},
mounted() {

View File

@ -0,0 +1,13 @@
import { QuoteSupportMastodon } from '~/src/constants/servers/quote'
const quoteSupported = (sns: 'mastodon' | 'pleroma' | 'misskey', domain: string): boolean => {
if (sns === 'misskey') {
return true
}
if (QuoteSupportMastodon.includes(domain)) {
return true
}
return false
}
export default quoteSupported