Merge branch 'users-statuses-pinia' into shigusegubu-themes3
This commit is contained in:
commit
97f2de913d
9 changed files with 13 additions and 23 deletions
|
|
@ -30,7 +30,7 @@ function showWhoToFollow(panel, reply) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWhoToFollow() {
|
function getWhoToFollow(panel) {
|
||||||
const credentials = useOAuthStore().token
|
const credentials = useOAuthStore().token
|
||||||
if (credentials) {
|
if (credentials) {
|
||||||
panel.usersToFollow.forEach((toFollow) => {
|
panel.usersToFollow.forEach((toFollow) => {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { map } from 'lodash'
|
import { map } from 'lodash'
|
||||||
|
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||||
import { useTimelinesStore } from 'src/stores/timelines.js'
|
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
editStatus as apiEditStatus,
|
editStatus as apiEditStatus,
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,6 @@ export const useChatsStore = defineStore('chats', {
|
||||||
const chat = getChatById(this, updatedChat.id)
|
const chat = getChatById(this, updatedChat.id)
|
||||||
|
|
||||||
if (chat) {
|
if (chat) {
|
||||||
const isNewMessage =
|
|
||||||
chat.lastMessage?.id !== updatedChat.lastMessage?.id
|
|
||||||
chat.lastMessage = updatedChat.lastMessage
|
chat.lastMessage = updatedChat.lastMessage
|
||||||
chat.unread = updatedChat.unread
|
chat.unread = updatedChat.unread
|
||||||
chat.updated_at = updatedChat.updated_at
|
chat.updated_at = updatedChat.updated_at
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import {
|
||||||
} from '../modules/default_config_state.js'
|
} from '../modules/default_config_state.js'
|
||||||
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useUsersStore } from 'src/stores/users.js'
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { fetchKnownDomains } from 'src/api/public.js'
|
import { fetchKnownDomains } from 'src/api/public.js'
|
||||||
|
|
@ -214,7 +213,7 @@ export const useInstanceStore = defineStore('instance', {
|
||||||
async getKnownDomains() {
|
async getKnownDomains() {
|
||||||
try {
|
try {
|
||||||
const { data } = await fetchKnownDomains({
|
const { data } = await fetchKnownDomains({
|
||||||
credentials: useOAuthStore().token
|
credentials: useOAuthStore().token,
|
||||||
})
|
})
|
||||||
this.knownDomains = data
|
this.knownDomains = data
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ export const useNotificationsStore = defineStore('notifications', {
|
||||||
Object.keys(blankState).forEach((k) => {
|
Object.keys(blankState).forEach((k) => {
|
||||||
this[k] = blankState[k]
|
this[k] = blankState[k]
|
||||||
})
|
})
|
||||||
console.log('[Notifications] Deactivated', this.fetcher)
|
console.debug('[Notifications] Deactivated', this.fetcher)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Poll & Push
|
// Poll & Push
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,9 @@ export const useStatusesStore = defineStore('statuses', {
|
||||||
|
|
||||||
const newStatus = {
|
const newStatus = {
|
||||||
...old,
|
...old,
|
||||||
...Object.fromEntries(Object.entries(neu).filter(([, v]) => v !== undefined)),
|
...Object.fromEntries(
|
||||||
|
Object.entries(neu).filter(([, v]) => v !== undefined),
|
||||||
|
),
|
||||||
user,
|
user,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export const useStreamingStore = defineStore('streaming', {
|
||||||
},
|
},
|
||||||
|
|
||||||
getSubArgs(stream) {
|
getSubArgs(stream) {
|
||||||
if (stream === undefined) return undefined
|
if (stream === undefined) return []
|
||||||
const argumentKey = ARGUMENT_MAP[stream.name]
|
const argumentKey = ARGUMENT_MAP[stream.name]
|
||||||
const args = argumentKey
|
const args = argumentKey
|
||||||
? {
|
? {
|
||||||
|
|
|
||||||
|
|
@ -183,10 +183,7 @@ export const useTimelinesStore = defineStore('timelines', {
|
||||||
pause(name) {
|
pause(name) {
|
||||||
const timeline = this[name]
|
const timeline = this[name]
|
||||||
timeline.paused = true
|
timeline.paused = true
|
||||||
console.debug(
|
console.debug('[Timelines] Pausing timeline', name)
|
||||||
'[Timelines] Pausing timeline',
|
|
||||||
name,
|
|
||||||
)
|
|
||||||
if (timeline.fetcher && timeline.fetching) {
|
if (timeline.fetcher && timeline.fetching) {
|
||||||
timeline.fetcher.stopFetching()
|
timeline.fetcher.stopFetching()
|
||||||
}
|
}
|
||||||
|
|
@ -194,10 +191,7 @@ export const useTimelinesStore = defineStore('timelines', {
|
||||||
resume(name) {
|
resume(name) {
|
||||||
const timeline = this[name]
|
const timeline = this[name]
|
||||||
timeline.paused = false
|
timeline.paused = false
|
||||||
console.debug(
|
console.debug('[Timelines] Resuming timeline', name)
|
||||||
'[Timelines] Resuming timeline',
|
|
||||||
name,
|
|
||||||
)
|
|
||||||
if (timeline.fetcher && timeline.fetching) {
|
if (timeline.fetcher && timeline.fetching) {
|
||||||
timeline.fetcher.startFetching()
|
timeline.fetcher.startFetching()
|
||||||
}
|
}
|
||||||
|
|
@ -286,13 +280,11 @@ export const useTimelinesStore = defineStore('timelines', {
|
||||||
this.stopFetchingTimeline(timeline, 'Socket connected')
|
this.stopFetchingTimeline(timeline, 'Socket connected')
|
||||||
},
|
},
|
||||||
onStreamDisconnect(timeline, argument) {
|
onStreamDisconnect(timeline, argument) {
|
||||||
console.debug('[Timelines] Stream disconnected', timeline, argument)
|
|
||||||
this[timeline].streaming = false
|
this[timeline].streaming = false
|
||||||
this.startFetchingTimeline(timeline, argument, 'Socket disconnected')
|
this.startFetchingTimeline(timeline, argument, 'Socket disconnected')
|
||||||
},
|
},
|
||||||
startFetchingTimeline(timelineName, argument, reason) {
|
startFetchingTimeline(timelineName, argument, reason) {
|
||||||
const timeline = this[timelineName]
|
const timeline = this[timelineName]
|
||||||
console.log('[Timelines]', toValue(timeline))
|
|
||||||
if (timeline.paused) {
|
if (timeline.paused) {
|
||||||
console.debug(
|
console.debug(
|
||||||
'[Timelines] NOT Starting timeline fetcher because it is paused',
|
'[Timelines] NOT Starting timeline fetcher because it is paused',
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import Cookies from 'js-cookie'
|
||||||
import { last } from 'lodash'
|
import { last } from 'lodash'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
import { WSConnectionStatus } from 'src/api/websocket.js'
|
|
||||||
|
|
||||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||||
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
||||||
import { useChatsStore } from 'src/stores/chats.js'
|
import { useChatsStore } from 'src/stores/chats.js'
|
||||||
|
|
@ -46,6 +44,7 @@ import {
|
||||||
unmuteDomain,
|
unmuteDomain,
|
||||||
unmuteUser,
|
unmuteUser,
|
||||||
} from 'src/api/user.js'
|
} from 'src/api/user.js'
|
||||||
|
import { WSConnectionStatus } from 'src/api/websocket.js'
|
||||||
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
||||||
|
|
||||||
export const useUsersStore = defineStore('users', {
|
export const useUsersStore = defineStore('users', {
|
||||||
|
|
@ -755,8 +754,8 @@ export const useUsersStore = defineStore('users', {
|
||||||
|
|
||||||
// Socket is most likely already closed by server
|
// Socket is most likely already closed by server
|
||||||
if (
|
if (
|
||||||
useMergedConfigStore().mergedConfig.useStreamingApi
|
useMergedConfigStore().mergedConfig.useStreamingApi &&
|
||||||
&& useStreamingStore().state !== WSConnectionStatus.CLOSED
|
useStreamingStore().state !== WSConnectionStatus.CLOSED
|
||||||
) {
|
) {
|
||||||
useStreamingStore().stopSocket()
|
useStreamingStore().stopSocket()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue