refs #677 Adjust streaming of Local and DM
This commit is contained in:
parent
bb124d886c
commit
1bcdc91ef6
|
@ -5,14 +5,6 @@
|
|||
<p class="description">{{ $t('settings.timeline.unread_notification.description') }}</p>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="title">
|
||||
{{ $t('settings.timeline.unread_notification.home') }}
|
||||
</td>
|
||||
<td class="status">
|
||||
<el-switch v-model="home" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">
|
||||
{{ $t('settings.timeline.unread_notification.direct') }}
|
||||
|
@ -55,19 +47,9 @@
|
|||
export default {
|
||||
name: 'Timeline',
|
||||
computed: {
|
||||
home: {
|
||||
get () {
|
||||
return this.$store.state.Settings.Timeline.unread_notification.home
|
||||
},
|
||||
set (value) {
|
||||
this.$store.dispatch('Settings/Timeline/changeUnreadNotification', {
|
||||
home: value
|
||||
})
|
||||
}
|
||||
},
|
||||
direct: {
|
||||
get () {
|
||||
return this.$store.state.Settings.Timeline.unread_notification.direct
|
||||
return this.$store.state.Settings.Timeline.unreadNotification.direct
|
||||
},
|
||||
set (value) {
|
||||
this.$store.dispatch('Settings/Timeline/changeUnreadNotification', {
|
||||
|
@ -77,7 +59,7 @@ export default {
|
|||
},
|
||||
favourite: {
|
||||
get () {
|
||||
return this.$store.state.Settings.Timeline.unread_notification.favourite
|
||||
return this.$store.state.Settings.Timeline.unreadNotification.favourite
|
||||
},
|
||||
set (value) {
|
||||
this.$store.dispatch('Settings/Timeline/changeUnreadNotification', {
|
||||
|
@ -87,7 +69,7 @@ export default {
|
|||
},
|
||||
local: {
|
||||
get () {
|
||||
return this.$store.state.Settings.Timeline.unread_notification.local
|
||||
return this.$store.state.Settings.Timeline.unreadNotification.local
|
||||
},
|
||||
set (value) {
|
||||
this.$store.dispatch('Settings/Timeline/changeUnreadNotification', {
|
||||
|
@ -97,7 +79,7 @@ export default {
|
|||
},
|
||||
public: {
|
||||
get () {
|
||||
return this.$store.state.Settings.Timeline.unread_notification.public
|
||||
return this.$store.state.Settings.Timeline.unreadNotification.public
|
||||
},
|
||||
set (value) {
|
||||
this.$store.dispatch('Settings/Timeline/changeUnreadNotification', {
|
||||
|
|
|
@ -72,20 +72,12 @@ export default {
|
|||
window.removeEventListener('dragleave', this.onDragLeave)
|
||||
window.removeEventListener('dragover', this.onDragOver)
|
||||
window.removeEventListener('drop', this.handleDrop)
|
||||
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
||||
this.$store.dispatch('TimelineSpace/stopDirectMessagesStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindDirectMessagesStreaming')
|
||||
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindLocalStreaming')
|
||||
this.$store.dispatch('TimelineSpace/stopStreamings')
|
||||
},
|
||||
methods: {
|
||||
async clear () {
|
||||
await this.$store.dispatch('TimelineSpace/clearAccount')
|
||||
await this.$store.commit('TimelineSpace/Contents/Home/clearTimeline')
|
||||
await this.$store.commit('TimelineSpace/Contents/Local/clearTimeline')
|
||||
await this.$store.commit('TimelineSpace/Contents/DirectMessages/clearTimeline')
|
||||
await this.$store.commit('TimelineSpace/Contents/Notifications/clearNotifications')
|
||||
this.$store.dispatch('TimelineSpace/clearContentsTimelines')
|
||||
await this.$store.dispatch('TimelineSpace/removeShortcutEvents')
|
||||
await this.$store.dispatch('TimelineSpace/clearUnread')
|
||||
return 'clear'
|
||||
|
@ -100,44 +92,23 @@ export default {
|
|||
type: 'error'
|
||||
})
|
||||
})
|
||||
try {
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
||||
} catch (err) {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
try {
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
|
||||
} catch (err) {
|
||||
this.$message({
|
||||
message: this.$t('message.notification_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
try {
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
||||
await this.$store.dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline', account)
|
||||
} catch (err) {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
this.$store.dispatch('TimelineSpace/SideMenu/fetchLists', account)
|
||||
this.$store.dispatch('TimelineSpace/bindUserStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
||||
.catch(() => {
|
||||
await this.$store.dispatch('TimelineSpace/loadUnreadNotification', this.$route.params.id)
|
||||
|
||||
// Load timelines
|
||||
await this.$store.dispatch('TimelineSpace/fetchContentsTimelines', account)
|
||||
.catch(_ => {
|
||||
this.$message({
|
||||
message: this.$t('message.start_streaming_error'),
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
this.$store.dispatch('TimelineSpace/bindLocalStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/bindDirectMessagesStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/startDirectMessagesStreaming', account)
|
||||
|
||||
// Bind streamings
|
||||
await this.$store.dispatch('TimelineSpace/bindStreamings', account)
|
||||
// Start streamings
|
||||
this.$store.dispatch('TimelineSpace/startStreamings', account)
|
||||
|
||||
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
||||
this.$store.dispatch('TimelineSpace/fetchInstance', account)
|
||||
},
|
||||
|
|
|
@ -44,15 +44,18 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState('TimelineSpace/Contents/DirectMessages', {
|
||||
timeline: state => state.timeline,
|
||||
lazyLoading: state => state.lazyLoading,
|
||||
heading: state => state.heading,
|
||||
unread: state => state.unreadTimeline,
|
||||
filter: state => state.filter
|
||||
}),
|
||||
...mapState({
|
||||
openSideBar: state => state.TimelineSpace.Contents.SideBar.openSideBar,
|
||||
backgroundColor: state => state.App.theme.background_color,
|
||||
startReload: state => state.TimelineSpace.HeaderMenu.reload,
|
||||
timeline: state => state.TimelineSpace.Contents.DirectMessages.timeline,
|
||||
lazyLoading: state => state.TimelineSpace.Contents.DirectMessages.lazyLoading,
|
||||
heading: state => state.TimelineSpace.Contents.DirectMessages.heading,
|
||||
unread: state => state.TimelineSpace.Contents.DirectMessages.unreadTimeline,
|
||||
filter: state => state.TimelineSpace.Contents.DirectMessages.filter
|
||||
unreadNotification: state => state.TimelineSpace.unreadNotification
|
||||
}),
|
||||
...mapGetters('TimelineSpace/Modals', [
|
||||
'modalOpened'
|
||||
|
@ -69,15 +72,29 @@ export default {
|
|||
return currentIndex === -1
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
async mounted () {
|
||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadDirectMessagesTimeline', false)
|
||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
||||
if (!this.unreadNotification.direct) {
|
||||
await this.initialize()
|
||||
.catch(_ => {
|
||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
})
|
||||
}
|
||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
},
|
||||
beforeUpdate () {
|
||||
if (this.$store.state.TimelineSpace.SideMenu.unreadDirectMessagesTimeline && this.heading) {
|
||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadDirectMessagesTimeline', false)
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
if (!this.unreadNotification.direct) {
|
||||
this.$store.dispatch('TimelineSpace/stopDirectMessagesStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindDirectMessagesStreaming')
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeHeading', true)
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/mergeTimeline')
|
||||
|
@ -106,6 +123,17 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
async initialize () {
|
||||
await this.$store.dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline')
|
||||
.catch(_ => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
await this.$store.dispatch('TimelineSpace/bindDirectMessagesStreaming')
|
||||
this.$store.dispatch('TimelineSpace/startDirectMessagesStreaming')
|
||||
},
|
||||
onScroll (event) {
|
||||
// for lazyLoading
|
||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('directmessages').clientHeight - 10) && !this.lazyloading) {
|
||||
|
|
|
@ -44,15 +44,18 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState('TimelineSpace/Contents/Local', {
|
||||
timeline: state => state.timeline,
|
||||
lazyLoading: state => state.lazyLoading,
|
||||
heading: state => state.heading,
|
||||
unread: state => state.unreadTimeline,
|
||||
filter: state => state.filter
|
||||
}),
|
||||
...mapState({
|
||||
openSideBar: state => state.TimelineSpace.Contents.SideBar.openSideBar,
|
||||
backgroundColor: state => state.App.theme.background_color,
|
||||
startReload: state => state.TimelineSpace.HeaderMenu.reload,
|
||||
timeline: state => state.TimelineSpace.Contents.Local.timeline,
|
||||
lazyLoading: state => state.TimelineSpace.Contents.Local.lazyLoading,
|
||||
heading: state => state.TimelineSpace.Contents.Local.heading,
|
||||
unread: state => state.TimelineSpace.Contents.Local.unreadTimeline,
|
||||
filter: state => state.TimelineSpace.Contents.Local.filter
|
||||
unreadNotification: state => state.TimelineSpace.unreadNotification
|
||||
}),
|
||||
...mapGetters('TimelineSpace/Modals', [
|
||||
'modalOpened'
|
||||
|
@ -69,15 +72,29 @@ export default {
|
|||
return currentIndex === -1
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
async mounted () {
|
||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', false)
|
||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
||||
if (!this.unreadNotification.local) {
|
||||
await this.initialize()
|
||||
.catch(_ => {
|
||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
})
|
||||
}
|
||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
},
|
||||
beforeUpdate () {
|
||||
if (this.$store.state.TimelineSpace.SideMenu.unreadLocalTimeline && this.heading) {
|
||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', false)
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
if (!this.unreadNotification.local) {
|
||||
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindLocalStreaming')
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', true)
|
||||
this.$store.commit('TimelineSpace/Contents/Local/mergeTimeline')
|
||||
|
@ -106,6 +123,17 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
async initialize () {
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline')
|
||||
.catch(_ => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
await this.$store.dispatch('TimelineSpace/bindLocalStreaming')
|
||||
this.$store.dispatch('TimelineSpace/startLocalStreaming')
|
||||
},
|
||||
updateToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/updateToot', message)
|
||||
},
|
||||
|
|
|
@ -3,8 +3,7 @@ import { ipcRenderer } from 'electron'
|
|||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
unread_notification: {
|
||||
home: true,
|
||||
unreadNotification: {
|
||||
direct: false,
|
||||
favourite: false,
|
||||
local: true,
|
||||
|
@ -13,7 +12,7 @@ export default {
|
|||
},
|
||||
mutations: {
|
||||
updateUnreadNotification (state, settings) {
|
||||
state.unread_notification = settings
|
||||
state.unreadNotification = settings
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -32,7 +31,7 @@ export default {
|
|||
})
|
||||
},
|
||||
changeUnreadNotification ({ dispatch, state, rootState }, timeline) {
|
||||
const settings = Object.assign({}, state.unread_notification, timeline, {
|
||||
const settings = Object.assign({}, state.unreadNotification, timeline, {
|
||||
accountID: rootState.Settings.accountID
|
||||
})
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
@ -22,7 +22,13 @@ const TimelineSpace = {
|
|||
},
|
||||
loading: false,
|
||||
emojis: [],
|
||||
tootMax: 500
|
||||
tootMax: 500,
|
||||
unreadNotification: {
|
||||
direct: false,
|
||||
favourite: false,
|
||||
local: true,
|
||||
public: false
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
updateAccount (state, account) {
|
||||
|
@ -45,9 +51,15 @@ const TimelineSpace = {
|
|||
} else {
|
||||
state.tootMax = 500
|
||||
}
|
||||
},
|
||||
updateUnreadNotification (state, settings) {
|
||||
state.unreadNotification = settings
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// -------------------------------------------------
|
||||
// Accounts
|
||||
// -------------------------------------------------
|
||||
localAccount ({ dispatch, commit }, id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.send('get-local-account', id)
|
||||
|
@ -87,6 +99,117 @@ const TimelineSpace = {
|
|||
})
|
||||
})
|
||||
},
|
||||
async clearAccount ({ commit }) {
|
||||
commit(
|
||||
'updateAccount',
|
||||
{
|
||||
domain: '',
|
||||
_id: '',
|
||||
username: ''
|
||||
}
|
||||
)
|
||||
return 'clearAccount'
|
||||
},
|
||||
// -----------------------------------------------
|
||||
// Shortcuts
|
||||
// -----------------------------------------------
|
||||
watchShortcutEvents ({ commit, dispatch }) {
|
||||
ipcRenderer.on('CmdOrCtrl+N', () => {
|
||||
dispatch('TimelineSpace/Modals/NewToot/openModal', {}, { root: true })
|
||||
})
|
||||
ipcRenderer.on('CmdOrCtrl+K', () => {
|
||||
commit('TimelineSpace/Modals/Jump/changeModal', true, { root: true })
|
||||
})
|
||||
},
|
||||
async removeShortcutEvents () {
|
||||
ipcRenderer.removeAllListeners('CmdOrCtrl+N')
|
||||
ipcRenderer.removeAllListeners('CmdOrCtrl+K')
|
||||
return 'removeShortcutEvents'
|
||||
},
|
||||
/**
|
||||
* clearUnread
|
||||
*/
|
||||
async clearUnread ({ dispatch }) {
|
||||
dispatch('TimelineSpace/SideMenu/clearUnread', {}, { root: true })
|
||||
},
|
||||
/**
|
||||
* fetchEmojis
|
||||
*/
|
||||
async fetchEmojis ({ commit }, account) {
|
||||
const data = await Mastodon.get('/custom_emojis', {}, account.baseURL + '/api/v1')
|
||||
commit('updateEmojis', data)
|
||||
return data
|
||||
},
|
||||
/**
|
||||
* fetchInstance
|
||||
*/
|
||||
async fetchInstance ({ commit }, account) {
|
||||
const data = await Mastodon.get('/instance', {}, account.baseURL + '/api/v1')
|
||||
commit('updateTootMax', data.max_toot_chars)
|
||||
return data
|
||||
},
|
||||
loadUnreadNotification ({ commit, rootState }, accountID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.once('response-get-unread-notification', (event, settings) => {
|
||||
ipcRenderer.removeAllListeners('error-get-unread-notification')
|
||||
commit('updateUnreadNotification', settings)
|
||||
resolve(settings)
|
||||
})
|
||||
ipcRenderer.once('error-get-unread-notification', (event, err) => {
|
||||
ipcRenderer.removeAllListeners('response-get-unread-notification')
|
||||
resolve(null)
|
||||
})
|
||||
ipcRenderer.send('get-unread-notification', accountID)
|
||||
})
|
||||
},
|
||||
async fetchContentsTimelines ({ dispatch, state }, account) {
|
||||
await dispatch('TimelineSpace/Contents/Home/fetchTimeline', account, { root: true })
|
||||
await dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account, { root: true })
|
||||
if (state.unreadNotification.direct) {
|
||||
await dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline', {}, { root: true })
|
||||
}
|
||||
if (state.unreadNotification.local) {
|
||||
await dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', {}, { root: true })
|
||||
}
|
||||
// TODO: public, favourite
|
||||
},
|
||||
clearContentsTimelines ({ commit }) {
|
||||
commit('TimelineSpace/Contents/Home/clearTimeline', {}, { root: true })
|
||||
commit('TimelineSpace/Contents/Local/clearTimeline', {}, { root: true })
|
||||
commit('TimelineSpace/Contents/DirectMessages/clearTimeline', {}, { root: true })
|
||||
commit('TimelineSpace/Contents/Notifications/clearNotifications', {}, { root: true })
|
||||
},
|
||||
bindStreamings ({ dispatch, state }, account) {
|
||||
dispatch('bindUserStreaming', account)
|
||||
if (state.unreadNotification.direct) {
|
||||
dispatch('bindDirectMessagesStreaming')
|
||||
}
|
||||
if (state.unreadNotification.local) {
|
||||
dispatch('bindLocalStreaming')
|
||||
}
|
||||
// TODO: public, favourite
|
||||
},
|
||||
startStreamings ({ dispatch, state }, account) {
|
||||
dispatch('startUserStreaming', account)
|
||||
if (state.unreadNotification.direct) {
|
||||
dispatch('startDirectMessagesStreaming')
|
||||
}
|
||||
if (state.unreadNotification.local) {
|
||||
dispatch('startLocalStreaming')
|
||||
}
|
||||
// TODO: public ,favourite
|
||||
},
|
||||
stopStreamings ({ dispatch }, account) {
|
||||
dispatch('stopUserStreaming')
|
||||
dispatch('stopDirectMessagesStreaming')
|
||||
dispatch('stopLocalStreaming')
|
||||
dispatch('unbindUserStreaming')
|
||||
dispatch('unbindDirectMessagesStreaming')
|
||||
dispatch('unbindLocalStreaming')
|
||||
},
|
||||
// ------------------------------------------------
|
||||
// Each streaming methods
|
||||
// ------------------------------------------------
|
||||
bindUserStreaming ({ commit, rootState }, account) {
|
||||
ipcRenderer.on('update-start-user-streaming', (event, update) => {
|
||||
commit('TimelineSpace/Contents/Home/appendTimeline', update, { root: true })
|
||||
|
@ -127,9 +250,9 @@ const TimelineSpace = {
|
|||
commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', true, { root: true })
|
||||
})
|
||||
},
|
||||
startLocalStreaming (_, account) {
|
||||
startLocalStreaming ({ state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.send('start-local-streaming', account)
|
||||
ipcRenderer.send('start-local-streaming', state.account)
|
||||
ipcRenderer.once('error-start-local-streaming', (event, err) => {
|
||||
reject(err)
|
||||
})
|
||||
|
@ -144,9 +267,9 @@ const TimelineSpace = {
|
|||
commit('TimelineSpace/SideMenu/changeUnreadDirectMessagesTimeline', true, { root: true })
|
||||
})
|
||||
},
|
||||
startDirectMessagesStreaming (_, account) {
|
||||
startDirectMessagesStreaming ({ state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.send('start-directmessages-streaming', account)
|
||||
ipcRenderer.send('start-directmessages-streaming', state.account)
|
||||
ipcRenderer.once('error-start-directmessages-streaming', (event, err) => {
|
||||
reject(err)
|
||||
})
|
||||
|
@ -173,43 +296,6 @@ const TimelineSpace = {
|
|||
},
|
||||
stopDirectMessagesStreaming () {
|
||||
ipcRenderer.send('stop-drectmessages-streaming')
|
||||
},
|
||||
watchShortcutEvents ({ commit, dispatch }) {
|
||||
ipcRenderer.on('CmdOrCtrl+N', () => {
|
||||
dispatch('TimelineSpace/Modals/NewToot/openModal', {}, { root: true })
|
||||
})
|
||||
ipcRenderer.on('CmdOrCtrl+K', () => {
|
||||
commit('TimelineSpace/Modals/Jump/changeModal', true, { root: true })
|
||||
})
|
||||
},
|
||||
async removeShortcutEvents () {
|
||||
ipcRenderer.removeAllListeners('CmdOrCtrl+N')
|
||||
ipcRenderer.removeAllListeners('CmdOrCtrl+K')
|
||||
return 'removeShortcutEvents'
|
||||
},
|
||||
async clearAccount ({ commit }) {
|
||||
commit(
|
||||
'updateAccount',
|
||||
{
|
||||
domain: '',
|
||||
_id: '',
|
||||
username: ''
|
||||
}
|
||||
)
|
||||
return 'clearAccount'
|
||||
},
|
||||
async clearUnread ({ dispatch }) {
|
||||
dispatch('TimelineSpace/SideMenu/clearUnread', {}, { root: true })
|
||||
},
|
||||
async fetchEmojis ({ commit }, account) {
|
||||
const data = await Mastodon.get('/custom_emojis', {}, account.baseURL + '/api/v1')
|
||||
commit('updateEmojis', data)
|
||||
return data
|
||||
},
|
||||
async fetchInstance ({ commit }, account) {
|
||||
const data = await Mastodon.get('/instance', {}, account.baseURL + '/api/v1')
|
||||
commit('updateTootMax', data.max_toot_chars)
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ const DirectMessages = {
|
|||
}
|
||||
},
|
||||
actions: {
|
||||
fetchTimeline ({ state, commit, rootState }, account) {
|
||||
fetchTimeline ({ state, commit, rootState }) {
|
||||
const client = new Mastodon(
|
||||
rootState.TimelineSpace.account.accessToken,
|
||||
rootState.TimelineSpace.account.baseURL + '/api/v1'
|
||||
|
|
|
@ -70,10 +70,10 @@ const Local = {
|
|||
}
|
||||
},
|
||||
actions: {
|
||||
fetchLocalTimeline ({ commit }, account) {
|
||||
fetchLocalTimeline ({ commit, rootState }) {
|
||||
const client = new Mastodon(
|
||||
account.accessToken,
|
||||
account.baseURL + '/api/v1'
|
||||
rootState.TimelineSpace.account.accessToken,
|
||||
rootState.TimelineSpace.account.baseURL + '/api/v1'
|
||||
)
|
||||
return client.get('/timelines/public', { limit: 40, local: true })
|
||||
.then(res => {
|
||||
|
|
Loading…
Reference in New Issue