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