Fix rpc object format for vuex v4

This commit is contained in:
AkiraFukushima 2022-04-20 17:48:34 +09:00
parent 85ef5e5f01
commit 8a3365baec
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
20 changed files with 200 additions and 494 deletions

View File

@ -608,11 +608,10 @@ ipcMain.handle('confirm-timelines', async (_event: IpcMainInvokeEvent, account:
// user streaming
const userStreamings: { [key: string]: UserStreaming | null } = {}
ipcMain.on('start-all-user-streamings', (event: IpcMainEvent, accounts: Array<LocalAccount>) => {
accounts.map(async account => {
const id: string = account._id!
ipcMain.on('start-all-user-streamings', (event: IpcMainEvent, accounts: Array<string>) => {
accounts.map(async id => {
const acct = await accountRepo.getAccount(id)
try {
const acct = await accountRepo.getAccount(id)
// Stop old user streaming
if (userStreamings[id]) {
userStreamings[id]!.stop()
@ -678,7 +677,7 @@ ipcMain.on('start-all-user-streamings', (event: IpcMainEvent, accounts: Array<Lo
}
} catch (err: any) {
log.error(err)
const streamingError = new StreamingError(err.message, account.domain)
const streamingError = new StreamingError(err.message, acct.domain)
if (!event.sender.isDestroyed()) {
event.sender.send('error-start-all-user-streamings', streamingError)
}
@ -708,16 +707,11 @@ const stopUserStreaming = (id: string) => {
})
}
type StreamingSetting = {
account: LocalAccount
}
let directMessagesStreaming: DirectStreaming | null = null
ipcMain.on('start-directmessages-streaming', async (event: IpcMainEvent, obj: StreamingSetting) => {
const { account } = obj
ipcMain.on('start-directmessages-streaming', async (event: IpcMainEvent, id: string) => {
try {
const acct = await accountRepo.getAccount(account._id!)
const acct = await accountRepo.getAccount(id)
// Stop old directmessages streaming
if (directMessagesStreaming !== null) {
@ -763,10 +757,9 @@ ipcMain.on('stop-directmessages-streaming', () => {
let localStreaming: LocalStreaming | null = null
ipcMain.on('start-local-streaming', async (event: IpcMainEvent, obj: StreamingSetting) => {
const { account } = obj
ipcMain.on('start-local-streaming', async (event: IpcMainEvent, id: string) => {
try {
const acct = await accountRepo.getAccount(account._id!)
const acct = await accountRepo.getAccount(id)
// Stop old local streaming
if (localStreaming !== null) {
@ -812,10 +805,9 @@ ipcMain.on('stop-local-streaming', () => {
let publicStreaming: PublicStreaming | null = null
ipcMain.on('start-public-streaming', async (event: IpcMainEvent, obj: StreamingSetting) => {
const { account } = obj
ipcMain.on('start-public-streaming', async (event: IpcMainEvent, id: string) => {
try {
const acct = await accountRepo.getAccount(account._id!)
const acct = await accountRepo.getAccount(id)
// Stop old public streaming
if (publicStreaming !== null) {
@ -861,14 +853,15 @@ ipcMain.on('stop-public-streaming', () => {
let listStreaming: ListStreaming | null = null
type ListID = {
type ListStreamingOpts = {
listID: string
accountID: string
}
ipcMain.on('start-list-streaming', async (event: IpcMainEvent, obj: ListID & StreamingSetting) => {
const { listID, account } = obj
ipcMain.on('start-list-streaming', async (event: IpcMainEvent, obj: ListStreamingOpts) => {
const { listID, accountID } = obj
try {
const acct = await accountRepo.getAccount(account._id!)
const acct = await accountRepo.getAccount(accountID)
// Stop old list streaming
if (listStreaming !== null) {
@ -915,14 +908,15 @@ ipcMain.on('stop-list-streaming', () => {
let tagStreaming: TagStreaming | null = null
type Tag = {
type TagStreamingOpts = {
tag: string
accountID: string
}
ipcMain.on('start-tag-streaming', async (event: IpcMainEvent, obj: Tag & StreamingSetting) => {
const { tag, account } = obj
ipcMain.on('start-tag-streaming', async (event: IpcMainEvent, obj: TagStreamingOpts) => {
const { tag, accountID } = obj
try {
const acct = await accountRepo.getAccount(account._id!)
const acct = await accountRepo.getAccount(accountID)
// Stop old tag streaming
if (tagStreaming !== null) {

View File

@ -22,55 +22,18 @@
<el-button type="text" class="reply" :title="$t('cards.toot.reply')">
<font-awesome-icon icon="reply" size="sm" />
</el-button>
<el-button
type="text"
class="reblog"
:title="$t('cards.toot.reblog')"
>
<el-button type="text" class="reblog" :title="$t('cards.toot.reblog')">
<font-awesome-icon icon="retweet" size="sm" />
</el-button>
<span class="count">
{{ reblogsCount }}
</span>
<el-button
type="text"
class="favourite"
:title="$t('cards.toot.fav')"
>
<el-button type="text" class="favourite" :title="$t('cards.toot.fav')">
<font-awesome-icon icon="star" size="sm" />
</el-button>
<span class="count">
{{ favouritesCount }}
</span>
<popper
trigger="click"
:options="{ placement: 'bottom' }"
ref="popper"
>
<div class="popper toot-menu">
<ul class="menu-list">
<li role="button">
{{ $t('cards.toot.view_toot_detail') }}
</li>
<li role="button">
{{ $t('cards.toot.open_in_browser') }}
</li>
<li role="button">
{{ $t('cards.toot.copy_link_to_toot') }}
</li>
<li role="button" class="separate">
{{ $t('cards.toot.delete') }}
</li>
</ul>
</div>
<el-button
slot="reference"
type="text"
:title="$t('cards.toot.detail')"
>
<font-awesome-icon icon="ellipsis" size="sm" />
</el-button>
</popper>
</div>
<div class="application">
{{ $t('cards.toot.via', { application: 'Whalebird' }) }}
@ -91,12 +54,12 @@ export default {
props: {
displayNameStyle: {
type: Number,
default: DisplayStyle.DisplayNameAndUsername.value,
default: DisplayStyle.DisplayNameAndUsername.value
},
timeFormat: {
type: Number,
default: TimeFormat.Absolute.value,
},
default: TimeFormat.Absolute.value
}
},
computed: {
sampleIcon() {
@ -135,8 +98,8 @@ export default {
},
favouritesCount() {
return 5
},
},
}
}
}
</script>

View File

@ -1,5 +1,5 @@
<template>
<el-form ref="form" class="section" label-width="200px" label-position="right" size="medium">
<el-form ref="form" class="section" label-width="200px" label-position="right" size="default">
<el-form-item :label="$t('settings.filters.form.phrase')">
<el-input v-model="filterPhrase"></el-input>
</el-form-item>

View File

@ -5,7 +5,7 @@
class="toot section"
label-width="250px"
label-position="right"
size="medium"
size="default"
>
<h3>{{ $t('settings.general.toot.title') }}</h3>
<el-form-item

View File

@ -3,7 +3,7 @@
<h2>{{ $t('settings.timeline.title') }}</h2>
<el-form
class="unread-notification section"
size="medium"
size="default"
label-position="right"
label-width="250px"
>
@ -34,7 +34,7 @@
<el-form
class="use-marker section"
size="medium"
size="default"
label-position="right"
label-width="250px"
>

View File

@ -65,7 +65,7 @@ export default {
this.$store.commit('TimelineSpace/Modals/Jump/changeModal', true)
})
},
beforeDestroy() {
beforeUnmount() {
window.removeEventListener('dragenter', this.onDragEnter)
window.removeEventListener('dragleave', this.onDragLeave)
window.removeEventListener('dragover', this.onDragOver)

View File

@ -8,30 +8,14 @@
role="article"
aria-label="account profile"
>
<div
class="header-background"
v-bind:style="{ backgroundImage: 'url(' + account.header + ')' }"
>
<div class="header-background" v-bind:style="{ backgroundImage: 'url(' + account.header + ')' }">
<div class="header">
<div
class="relationship"
v-if="relationship !== null && relationship !== '' && !isOwnProfile"
>
<div class="relationship" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
<div class="follower-status">
<el-tag
class="status"
size="small"
v-if="relationship.followed_by"
>{{ $t('side_bar.account_profile.follows_you') }}</el-tag
>
<el-tag class="status" size="medium" v-else>{{
$t('side_bar.account_profile.doesnt_follow_you')
}}</el-tag>
<el-tag class="status" size="small" v-if="relationship.followed_by">{{ $t('side_bar.account_profile.follows_you') }}</el-tag>
<el-tag class="status" size="default" v-else>{{ $t('side_bar.account_profile.doesnt_follow_you') }}</el-tag>
</div>
<div
class="notify"
v-if="relationship !== null && relationship !== '' && !isOwnProfile"
>
<div class="notify" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
<div
v-if="relationship.notifying"
class="unsubscribe"
@ -40,89 +24,54 @@
>
<font-awesome-icon icon="bell" size="xl" />
</div>
<div
v-else
class="subscribe"
@click="subscribe(account)"
:title="$t('side_bar.account_profile.subscribe')"
>
<div v-else class="subscribe" @click="subscribe(account)" :title="$t('side_bar.account_profile.subscribe')">
<font-awesome-icon :icon="['far', 'bell']" size="xl" />
</div>
</div>
</div>
<div class="user-info">
<div
class="more"
v-if="relationship !== null && relationship !== '' && !isOwnProfile"
>
<popper
trigger="click"
:options="{ placement: 'bottom' }"
ref="popper"
>
<div class="popper">
<ul class="menu-list">
<li role="button" @click="openBrowser(account)">
{{ $t('side_bar.account_profile.open_in_browser') }}
</li>
<li role="button" @click="addToList(account)">
{{ $t('side_bar.account_profile.manage_list_memberships') }}
</li>
<li role="button" @click="unmute(account)" v-if="muting">
{{ $t('side_bar.account_profile.unmute') }}
</li>
<li role="button" @click="confirmMute(account)" v-else>
{{ $t('side_bar.account_profile.mute') }}
</li>
<li role="button" @click="unblock(account)" v-if="blocking">
{{ $t('side_bar.account_profile.unblock') }}
</li>
<li role="button" @click="block(account)" v-else>
{{ $t('side_bar.account_profile.block') }}
</li>
</ul>
</div>
<div class="more" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
<el-popover placement="bottom" width="200" trigger="click" ref="popper">
<ul class="menu-list">
<li role="button" @click="openBrowser(account)">
{{ $t('side_bar.account_profile.open_in_browser') }}
</li>
<li role="button" @click="addToList(account)">
{{ $t('side_bar.account_profile.manage_list_memberships') }}
</li>
<li role="button" @click="unmute(account)" v-if="muting">
{{ $t('side_bar.account_profile.unmute') }}
</li>
<li role="button" @click="confirmMute(account)" v-else>
{{ $t('side_bar.account_profile.mute') }}
</li>
<li role="button" @click="unblock(account)" v-if="blocking">
{{ $t('side_bar.account_profile.unblock') }}
</li>
<li role="button" @click="block(account)" v-else>
{{ $t('side_bar.account_profile.block') }}
</li>
</ul>
<el-button
slot="reference"
type="text"
:title="$t('side_bar.account_profile.detail')"
>
<font-awesome-icon icon="gear" size="xl" />
</el-button>
</popper>
<template #reference>
<el-button type="text" :title="$t('side_bar.account_profile.detail')">
<font-awesome-icon icon="gear" size="xl" />
</el-button>
</template>
</el-popover>
</div>
<div class="icon" role="presentation">
<FailoverImg
:src="account.avatar"
:alt="`Avatar of ${account.username}`"
/>
<FailoverImg :src="account.avatar" :alt="`Avatar of ${account.username}`" />
</div>
<div
class="follow-status"
v-if="relationship !== null && relationship !== '' && !isOwnProfile"
>
<div
v-if="relationship.following"
class="unfollow"
@click="unfollow(account)"
:title="$t('side_bar.account_profile.unfollow')"
>
<div class="follow-status" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
<div v-if="relationship.following" class="unfollow" @click="unfollow(account)" :title="$t('side_bar.account_profile.unfollow')">
<font-awesome-icon icon="user-xmark" size="xl" />
</div>
<div
v-else-if="relationship.requested"
:title="$t('side_bar.account_profile.follow_requested')"
>
<div v-else-if="relationship.requested" :title="$t('side_bar.account_profile.follow_requested')">
<font-awesome-icon icon="hourglass" size="xl" />
</div>
<div
v-else
class="follow"
@click="follow(account)"
:title="$t('side_bar.account_profile.follow')"
>
<div v-else class="follow" @click="follow(account)" :title="$t('side_bar.account_profile.follow')">
<font-awesome-icon icon="user-plus" size="xl" />
</div>
</div>
@ -131,11 +80,7 @@
<bdi v-html="username(account)"></bdi>
</div>
<div class="account">@{{ account.acct }}</div>
<div
class="note"
v-html="note(account)"
@click.capture.prevent="noteClick"
></div>
<div class="note" v-html="note(account)" @click.capture.prevent="noteClick"></div>
</div>
</div>
<div class="identity">
@ -157,11 +102,7 @@
</dl>
</div>
<el-row class="basic-info">
<el-col
:span="8"
:class="activeTab === 1 ? 'info info-active' : 'info'"
@click="changeTab"
>
<el-col :span="8" :class="activeTab === 1 ? 'info info-active' : 'info'" @click="changeTab">
<el-button type="text" class="tab" @click="changeTab(1)">
<div class="title">{{ $t('side_bar.account_profile.toots') }}</div>
<div class="count">{{ account.statuses_count }}</div>
@ -205,34 +146,32 @@ export default {
Timeline,
Follows,
Followers,
FailoverImg,
FailoverImg
},
data() {
return {
activeTab: 1,
activeTab: 1
}
},
computed: {
...mapState({
theme: (state) => {
theme: state => {
return {
'--theme-mask-color': state.App.theme.wrapper_mask_color,
'--theme-border-color': state.App.theme.border_color,
'--theme-primary-color': state.App.theme.primary_color,
'--theme-primary-color': state.App.theme.primary_color
}
},
}
}),
...mapState('TimelineSpace/Contents/SideBar/AccountProfile', {
account: (state) => state.account,
identityProofs: (state) => state.identityProofs,
relationship: (state) => state.relationship,
loading: (state) => state.loading,
muting: (state) => state.relationship && state.relationship.muting,
blocking: (state) => state.relationship && state.relationship.blocking,
account: state => state.account,
identityProofs: state => state.identityProofs,
relationship: state => state.relationship,
loading: state => state.loading,
muting: state => state.relationship && state.relationship.muting,
blocking: state => state.relationship && state.relationship.blocking
}),
...mapGetters('TimelineSpace/Contents/SideBar/AccountProfile', [
'isOwnProfile',
]),
...mapGetters('TimelineSpace/Contents/SideBar/AccountProfile', ['isOwnProfile'])
},
watch: {
account: function () {
@ -240,7 +179,7 @@ export default {
},
loading: function (newState, _oldState) {
this.$emit('change-loading', newState)
},
}
},
methods: {
username(account) {
@ -260,47 +199,29 @@ export default {
}
},
follow(account) {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
true
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', true)
try {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/follow',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/follow', account)
} catch (err) {
this.$message({
message: this.$t('message.follow_error'),
type: 'error',
type: 'error'
})
} finally {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
false
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', false)
}
},
unfollow(account) {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
true
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', true)
try {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/unfollow',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/unfollow', account)
} catch (err) {
this.$message({
message: this.$t('message.unfollow_error'),
type: 'error',
type: 'error'
})
} finally {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
false
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', false)
}
},
changeTab(index) {
@ -311,43 +232,25 @@ export default {
this.$refs.popper.doClose()
},
addToList(account) {
this.$store.dispatch(
'TimelineSpace/Modals/ListMembership/setAccount',
account
)
this.$store.dispatch(
'TimelineSpace/Modals/ListMembership/changeModal',
true
)
this.$store.dispatch('TimelineSpace/Modals/ListMembership/setAccount', account)
this.$store.dispatch('TimelineSpace/Modals/ListMembership/changeModal', true)
this.$refs.popper.doClose()
},
confirmMute(account) {
this.$store.dispatch(
'TimelineSpace/Modals/MuteConfirm/changeAccount',
account
)
this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeAccount', account)
this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeModal', true)
this.$refs.popper.doClose()
},
unmute(account) {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/unmute',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/unmute', account)
this.$refs.popper.doClose()
},
block(account) {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/block',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/block', account)
this.$refs.popper.doClose()
},
unblock(account) {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/unblock',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/unblock', account)
this.$refs.popper.doClose()
},
metadataClick(e) {
@ -360,50 +263,32 @@ export default {
return window.shell.openExternal(link)
},
subscribe(account) {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
true
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', true)
try {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/subscribe',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/subscribe', account)
} catch (err) {
this.$message({
message: this.$t('message.subscribe_error'),
type: 'error',
type: 'error'
})
} finally {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
false
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', false)
}
},
unsubscribe(account) {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
true
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', true)
try {
this.$store.dispatch(
'TimelineSpace/Contents/SideBar/AccountProfile/unsubscribe',
account
)
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/unsubscribe', account)
} catch (err) {
this.$message({
message: this.$t('message.unsubscribe_error'),
type: 'error',
type: 'error'
})
} finally {
this.$store.commit(
'TimelineSpace/Contents/SideBar/AccountProfile/changeLoading',
false
)
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/changeLoading', false)
}
},
},
}
}
}
</script>

View File

@ -4,81 +4,30 @@
<h1>{{ title }}</h1>
</div>
<div class="tools">
<img
src="../../assets/images/loading-spinner-wide.svg"
v-show="loading"
class="header-loading"
/>
<el-button
type="text"
class="action"
@click="openNewTootModal"
:title="$t('header_menu.new_toot')"
>
<img src="../../assets/images/loading-spinner-wide.svg" v-show="loading" class="header-loading" />
<el-button type="text" class="action" @click="openNewTootModal" :title="$t('header_menu.new_toot')">
<font-awesome-icon :icon="['far', 'pen-to-square']" />
</el-button>
<el-button
v-show="reloadable()"
type="text"
class="action"
@click="reload"
:title="$t('header_menu.reload')"
>
<el-button v-show="reloadable()" type="text" class="action" @click="reload" :title="$t('header_menu.reload')">
<font-awesome-icon icon="rotate" />
</el-button>
<el-popover
placement="left-start"
width="180"
popper-class="theme-popover"
trigger="click"
v-model="TLOptionVisible"
>
<el-popover placement="left-start" width="180" popper-class="theme-popover" trigger="click" v-model="TLOptionVisible">
<div>
<el-form
role="form"
label-position="left"
label-width="125px"
size="medium"
>
<el-form-item
for="show-reblogs"
:label="$t('header_menu.option.show_reblogs')"
>
<el-checkbox
id="show-reblogs"
v-model="showReblogs"
></el-checkbox>
<el-form role="form" label-position="left" label-width="125px" size="default">
<el-form-item for="show-reblogs" :label="$t('header_menu.option.show_reblogs')">
<el-checkbox id="show-reblogs" v-model="showReblogs"></el-checkbox>
</el-form-item>
<el-form-item
for="show-replies"
:label="$t('header_menu.option.show_replies')"
>
<el-checkbox
id="show-replies"
v-model="showReplies"
></el-checkbox>
<el-form-item for="show-replies" :label="$t('header_menu.option.show_replies')">
<el-checkbox id="show-replies" v-model="showReplies"></el-checkbox>
</el-form-item>
<el-button type="primary" @click="applyTLOption">{{
$t('header_menu.option.apply')
}}</el-button>
<el-button type="primary" @click="applyTLOption">{{ $t('header_menu.option.apply') }}</el-button>
</el-form>
</div>
<el-button
v-show="TLOption()"
slot="reference"
type="text"
class="action"
:title="$t('header_menu.option.title')"
>
<el-button v-show="TLOption()" slot="reference" type="text" class="action" :title="$t('header_menu.option.title')">
<font-awesome-icon icon="sliders" />
</el-button>
</el-popover>
<el-button
type="text"
class="action"
@click="settings"
:title="$t('header_menu.settings')"
>
<el-button type="text" class="action" @click="settings" :title="$t('header_menu.settings')">
<font-awesome-icon icon="gear" />
</el-button>
</div>
@ -94,14 +43,14 @@ export default {
return {
TLOptionVisible: false,
showReblogs: true,
showReplies: true,
showReplies: true
}
},
computed: {
...mapState('TimelineSpace/HeaderMenu', {
title: (state) => state.title,
loading: (state) => state.loading,
}),
title: state => state.title,
loading: state => state.loading
})
},
created() {
this.channelName()
@ -112,7 +61,7 @@ export default {
$route: function () {
this.channelName()
this.loadTLOption()
},
}
},
methods: {
id() {
@ -121,101 +70,53 @@ export default {
channelName() {
switch (this.$route.name) {
case 'home':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.home')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.home'))
break
case 'notifications':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.notification')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.notification'))
break
case 'favourites':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.favourite')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.favourite'))
break
case 'bookmarks':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.bookmark')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.bookmark'))
break
case 'mentions':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.mention')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.mention'))
break
case 'follow-requests':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.follow_requests')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.follow_requests'))
break
case 'local':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.local')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.local'))
break
case 'public':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.public')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.public'))
break
case 'hashtag-list':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.hashtag')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.hashtag'))
break
case 'tag':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
`#${this.$route.params.tag}`
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', `#${this.$route.params.tag}`)
break
case 'search':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.search')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.search'))
break
case 'lists':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.lists')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.lists'))
break
case 'direct-messages':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.direct_messages')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.direct_messages'))
break
case 'edit-list':
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.members')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.members'))
break
case 'list':
this.$store.dispatch(
'TimelineSpace/HeaderMenu/fetchList',
this.$route.params.list_id
)
this.$store.dispatch('TimelineSpace/HeaderMenu/fetchList', this.$route.params.list_id)
break
default:
console.log(this.$route)
this.$store.commit(
'TimelineSpace/HeaderMenu/updateTitle',
this.$t('header_menu.home')
)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.home'))
break
}
},
@ -260,10 +161,8 @@ export default {
loadTLOption() {
switch (this.$route.name) {
case 'home':
this.showReblogs =
this.$store.state.TimelineSpace.Contents.Home.showReblogs
this.showReplies =
this.$store.state.TimelineSpace.Contents.Home.showReplies
this.showReblogs = this.$store.state.TimelineSpace.Contents.Home.showReblogs
this.showReplies = this.$store.state.TimelineSpace.Contents.Home.showReplies
break
default:
console.log('Not implemented')
@ -272,14 +171,8 @@ export default {
applyTLOption() {
switch (this.$route.name) {
case 'home':
this.$store.commit(
'TimelineSpace/Contents/Home/showReblogs',
this.showReblogs
)
this.$store.commit(
'TimelineSpace/Contents/Home/showReplies',
this.showReplies
)
this.$store.commit('TimelineSpace/Contents/Home/showReblogs', this.showReblogs)
this.$store.commit('TimelineSpace/Contents/Home/showReplies', this.showReplies)
break
default:
console.log('Not implemented')
@ -297,8 +190,8 @@ export default {
settings() {
const url = `/${this.id()}/settings`
this.$router.push(url)
},
},
}
}
}
</script>

View File

@ -44,13 +44,13 @@
v-if="!isShowContent(message.status)"
plain
type="primary"
size="medium"
size="default"
class="spoil-button"
@click="showContent = true"
>
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else plain type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else plain type="primary" size="default" class="spoil-button" @click="showContent = false">
{{ $t('cards.toot.hide') }}
</el-button>
</div>

View File

@ -44,13 +44,13 @@
v-if="!isShowContent(message.status)"
plain
type="primary"
size="medium"
size="default"
class="spoil-button"
@click="showContent = true"
>
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else plain type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else plain type="primary" size="default" class="spoil-button" @click="showContent = false">
{{ $t('cards.toot.hide') }}
</el-button>
</div>

View File

@ -44,13 +44,13 @@
v-if="!isShowContent(message.status)"
plain
type="primary"
size="medium"
size="default"
class="spoil-button"
@click="showContent = true"
>
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else plain type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else plain type="primary" size="default" class="spoil-button" @click="showContent = false">
{{ $t('cards.toot.hide') }}
</el-button>
</div>

View File

@ -46,13 +46,13 @@
v-if="!isShowContent(message.status)"
plain
type="primary"
size="medium"
size="default"
class="spoil-button"
@click="showContent = true"
>
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else plain type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else plain type="primary" size="default" class="spoil-button" @click="showContent = false">
{{ $t('cards.toot.hide') }}
</el-button>
</div>

View File

@ -44,13 +44,13 @@
v-if="!isShowContent(message.status)"
plain
type="primary"
size="medium"
size="default"
class="spoil-button"
@click="showContent = true"
>
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else plain type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else plain type="primary" size="default" class="spoil-button" @click="showContent = false">
{{ $t('cards.toot.hide') }}
</el-button>
</div>

View File

@ -46,13 +46,13 @@
v-if="!isShowContent(message.status)"
plain
type="primary"
size="medium"
size="default"
class="spoil-button"
@click="showContent = true"
>
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else plain type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else plain type="primary" size="default" class="spoil-button" @click="showContent = false">
{{ $t('cards.toot.hide') }}
</el-button>
</div>

View File

@ -39,10 +39,10 @@
<div class="content-wrapper">
<div class="spoiler" v-show="spoilered">
<span v-html="emojiText(originalMessage.spoiler_text, originalMessage.emojis)"></span>
<el-button v-if="!isShowContent" plain type="primary" size="medium" class="spoil-button" @click="toggleSpoiler">
<el-button v-if="!isShowContent" plain type="primary" size="default" class="spoil-button" @click="toggleSpoiler">
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else type="primary" size="medium" class="spoil-button" @click="toggleSpoiler">
<el-button v-else type="primary" size="default" class="spoil-button" @click="toggleSpoiler">
{{ $t('cards.toot.hide') }}
</el-button>
</div>
@ -99,10 +99,10 @@
/>
<div class="emoji-reactions">
<template v-for="reaction in originalMessage.emoji_reactions">
<el-button v-if="reaction.me" type="success" size="medium" class="reaction" @click="removeReaction(reaction.name)"
<el-button v-if="reaction.me" type="success" size="default" class="reaction" @click="removeReaction(reaction.name)"
>{{ reaction.name }} {{ reaction.count }}</el-button
>
<el-button v-else type="text" size="medium" class="reaction" @click="addReaction(reaction.name)"
<el-button v-else type="text" size="default" class="reaction" @click="addReaction(reaction.name)"
>{{ reaction.name }} {{ reaction.count }}</el-button
>
</template>
@ -156,44 +156,29 @@
<font-awesome-icon icon="quote-right" size="sm" />
</el-button>
<template v-if="sns !== 'mastodon'">
<el-popover
placement="bottom"
width="281"
trigger="click"
popper-class="status-emoji-picker"
ref="status_emoji_picker"
@show="openPicker"
@hide="hidePicker"
>
<el-popover placement="bottom" width="281" trigger="click" popper-class="status-emoji-picker" ref="status_emoji_picker">
<picker
v-if="openEmojiPicker"
set="emojione"
:data="emojiIndex"
set="twitter"
:autoFocus="true"
@select="selectEmoji"
:sheetSize="32"
:perLine="7"
:emojiSize="24"
:showPreview="false"
:emojiTooltip="true"
/>
<el-button slot="reference" class="emoji" type="text">
<font-awesome-icon :icon="['far', 'face-smile']" size="sm" />
</el-button>
<template #reference>
<el-button class="emoji" type="text">
<font-awesome-icon :icon="['far', 'face-smile']" size="sm" />
</el-button>
</template>
</el-popover>
</template>
<el-button class="pinned" type="text" :title="$t('cards.toot.pinned')" :aria-label="$t('cards.toot.pinned')" v-show="pinned">
<font-awesome-icon icon="thumbtack" size="sm" />
</el-button>
<el-popover
placement="bottom"
width="200"
trigger="click"
popper-class="status-menu-popper"
ref="status_menu_popper"
@show="openMenu"
@hide="hideMenu"
>
<ul class="menu-list" v-if="openToolMenu">
<el-popover placement="bottom" width="200" trigger="click" popper-class="status-menu-popper" ref="status_menu_popper">
<ul class="menu-list">
<li role="button" @click="openDetail(message)" v-show="!detailed">
{{ $t('cards.toot.view_toot_detail') }}
</li>
@ -216,9 +201,11 @@
{{ $t('cards.toot.delete') }}
</li>
</ul>
<el-button slot="reference" type="text" :title="$t('cards.toot.detail')">
<font-awesome-icon icon="ellipsis" size="sm" />
</el-button>
<template #reference>
<el-button type="text" :title="$t('cards.toot.detail')">
<font-awesome-icon icon="ellipsis" size="sm" />
</el-button>
</template>
</el-popover>
</div>
<div class="application" v-show="application !== null">
@ -234,9 +221,10 @@
<script>
import 'emoji-mart-vue-fast/css/emoji-mart.css'
import data from 'emoji-mart-vue-fast/data/all.json'
import moment from 'moment'
import { mapState } from 'vuex'
import { Picker } from 'emoji-mart-vue-fast/src'
import { Picker, EmojiIndex } from 'emoji-mart-vue-fast/src'
import ClickOutside from 'vue-click-outside'
import { findAccount, findLink, findTag } from '~/src/renderer/utils/tootParser'
import DisplayStyle from '~/src/constants/displayStyle'
@ -250,6 +238,8 @@ import { setInterval, clearInterval } from 'timers'
import QuoteSupported from '@/utils/quoteSupported'
import Filtered from '@/utils/filter'
const emojiIndex = new EmojiIndex(data)
export default {
name: 'toot',
directives: {
@ -268,8 +258,7 @@ export default {
showAttachments: this.$store.state.App.ignoreNSFW,
hideAllAttachments: this.$store.state.App.hideAllAttachments,
now: Date.now(),
openEmojiPicker: false,
openToolMenu: false
emojiIndex: emojiIndex
}
},
props: {
@ -312,7 +301,7 @@ export default {
bookmarkSupported: state => state.enabledTimelines.bookmark
}),
shortcutEnabled: function () {
return this.focused && !this.overlaid && !this.openEmojiPicker
return this.focused && !this.overlaid
},
timestamp: function () {
return this.parseDatetime(this.originalMessage.created_at, this.now)
@ -389,7 +378,7 @@ export default {
this.$data.now = Date.now()
}, 60000)
},
beforeDestroy() {
beforeUnmount() {
clearInterval(this.updateInterval)
},
watch: {
@ -710,18 +699,6 @@ export default {
openQuote() {
this.$store.dispatch('TimelineSpace/Modals/NewToot/openQuote', this.originalMessage)
},
openPicker() {
this.openEmojiPicker = true
},
hidePicker() {
this.openEmojiPicker = false
},
openMenu() {
this.openToolMenu = true
},
hideMenu() {
this.openToolMenu = false
},
toggleSpoiler() {
this.showContent = !this.showContent
this.$emit('sizeChanged', true)

View File

@ -63,8 +63,6 @@ import {
faBell as farBell
} from '@fortawesome/free-regular-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
// import Popper from 'vue-popperjs'
// import 'vue-popperjs/dist/vue-popper.css'
import { sync } from 'vuex-router-sync'
// import shortkey from 'vue-shortkey'
import { createI18n } from 'vue-i18n'
@ -152,7 +150,6 @@ app.use(VueVirtualScroller)
app.use(VueResize)
app.use(i18n)
// Vue.use(shortkey)
// Vue.component('popper', Popper)
sync(store, router)

View File

@ -5,7 +5,7 @@ import { RootState } from '@/store'
import { StreamingError } from '~src/errors/streamingError'
import { MyWindow } from '~/src/types/global'
const win = (window as any) as MyWindow
const win = window as any as MyWindow
export type GlobalHeaderState = {
accounts: Array<LocalAccount>
@ -111,7 +111,10 @@ const actions: ActionTree<GlobalHeaderState, RootState> = {
win.ipcRenderer.once('error-start-all-user-streamings', (_, err: StreamingError) => {
reject(err)
})
win.ipcRenderer.send('start-all-user-streamings', state.accounts)
win.ipcRenderer.send(
'start-all-user-streamings',
state.accounts.map(a => a._id)
)
})
},
stopUserStreamings: () => {

View File

@ -12,7 +12,7 @@ import { MyWindow } from '~/src/types/global'
import { Timeline, Setting } from '~src/types/setting'
import { DefaultSetting } from '~/src/constants/initializer/setting'
const win = (window as any) as MyWindow
const win = window as any as MyWindow
export type TimelineSpaceState = {
account: LocalAccount
@ -319,9 +319,7 @@ const actions: ActionTree<TimelineSpaceState, RootState> = {
// @ts-ignore
return new Promise((resolve, reject) => {
// eslint-disable-line no-unused-vars
win.ipcRenderer.send('start-local-streaming', {
account: state.account
})
win.ipcRenderer.send('start-local-streaming', state.account._id)
win.ipcRenderer.once('error-start-local-streaming', (_, err: Error) => {
reject(err)
})
@ -343,9 +341,7 @@ const actions: ActionTree<TimelineSpaceState, RootState> = {
// @ts-ignore
return new Promise((resolve, reject) => {
// eslint-disable-line no-unused-vars
win.ipcRenderer.send('start-public-streaming', {
account: state.account
})
win.ipcRenderer.send('start-public-streaming', state.account._id)
win.ipcRenderer.once('error-start-public-streaming', (_, err: Error) => {
reject(err)
})
@ -367,9 +363,7 @@ const actions: ActionTree<TimelineSpaceState, RootState> = {
// @ts-ignore
return new Promise((resolve, reject) => {
// eslint-disable-line no-unused-vars
win.ipcRenderer.send('start-directmessages-streaming', {
account: state.account
})
win.ipcRenderer.send('start-directmessages-streaming', state.account._id)
win.ipcRenderer.once('error-start-directmessages-streaming', (_, err: Error) => {
reject(err)
})

View File

@ -4,7 +4,7 @@ import { RootState } from '@/store'
import { LoadPositionWithTag } from '@/types/loadPosition'
import { MyWindow } from '~/src/types/global'
const win = (window as any) as MyWindow
const win = window as any as MyWindow
export type TagState = {
timeline: Array<Entity.Status>
@ -115,7 +115,7 @@ const actions: ActionTree<TagState, RootState> = {
// eslint-disable-line no-unused-vars
win.ipcRenderer.send('start-tag-streaming', {
tag: encodeURIComponent(tag),
account: rootState.TimelineSpace.account
accountID: rootState.TimelineSpace.account._id
})
win.ipcRenderer.once('error-start-tag-streaming', (_, err: Error) => {
reject(err)

View File

@ -4,7 +4,7 @@ import { RootState } from '@/store'
import { LoadPositionWithList } from '@/types/loadPosition'
import { MyWindow } from '~/src/types/global'
const win = (window as any) as MyWindow
const win = window as any as MyWindow
export type ShowState = {
timeline: Array<Entity.Status>
@ -115,7 +115,7 @@ const actions: ActionTree<ShowState, RootState> = {
// eslint-disable-line no-unused-vars
win.ipcRenderer.send('start-list-streaming', {
listID: listID,
account: rootState.TimelineSpace.account
accountID: rootState.TimelineSpace.account._id
})
win.ipcRenderer.once('error-start-list-streaming', (_, err: Error) => {
reject(err)