diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js index bd0eaf5e1..0f7f93556 100644 --- a/src/components/who_to_follow_panel/who_to_follow_panel.js +++ b/src/components/who_to_follow_panel/who_to_follow_panel.js @@ -30,7 +30,7 @@ function showWhoToFollow(panel, reply) { }) } -function getWhoToFollow(panel) { +function getWhoToFollow() { const credentials = useOAuthStore().token if (credentials) { panel.usersToFollow.forEach((toFollow) => { diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index f7877be15..41038573d 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -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, diff --git a/src/stores/chats.js b/src/stores/chats.js index 2f7d4f0b6..82bb638dd 100644 --- a/src/stores/chats.js +++ b/src/stores/chats.js @@ -81,6 +81,8 @@ 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 diff --git a/src/stores/instance.js b/src/stores/instance.js index 0d1da35d0..12480e8c1 100644 --- a/src/stores/instance.js +++ b/src/stores/instance.js @@ -13,6 +13,7 @@ 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' @@ -213,7 +214,7 @@ export const useInstanceStore = defineStore('instance', { async getKnownDomains() { try { const { data } = await fetchKnownDomains({ - credentials: useOAuthStore().token, + credentials: useOAuthStore().token }) this.knownDomains = data } catch (e) { diff --git a/src/stores/notifications.js b/src/stores/notifications.js index 4f18ccc21..3405fb352 100644 --- a/src/stores/notifications.js +++ b/src/stores/notifications.js @@ -94,7 +94,7 @@ export const useNotificationsStore = defineStore('notifications', { Object.keys(blankState).forEach((k) => { this[k] = blankState[k] }) - console.debug('[Notifications] Deactivated', this.fetcher) + console.log('[Notifications] Deactivated', this.fetcher) }, // Poll & Push diff --git a/src/stores/statuses.js b/src/stores/statuses.js index 11a5b81bc..337cb399d 100644 --- a/src/stores/statuses.js +++ b/src/stores/statuses.js @@ -149,9 +149,7 @@ 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, } diff --git a/src/stores/streaming.js b/src/stores/streaming.js index 9233124b5..1b4d07292 100644 --- a/src/stores/streaming.js +++ b/src/stores/streaming.js @@ -131,7 +131,7 @@ export const useStreamingStore = defineStore('streaming', { }, getSubArgs(stream) { - if (stream === undefined) return [] + if (stream === undefined) return undefined const argumentKey = ARGUMENT_MAP[stream.name] const args = argumentKey ? { diff --git a/src/stores/timelines.js b/src/stores/timelines.js index 99864b162..190396f48 100644 --- a/src/stores/timelines.js +++ b/src/stores/timelines.js @@ -183,7 +183,10 @@ 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() } @@ -191,7 +194,10 @@ 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() } @@ -280,11 +286,13 @@ 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', diff --git a/src/stores/users.js b/src/stores/users.js index 2a88e9295..9b824bf04 100644 --- a/src/stores/users.js +++ b/src/stores/users.js @@ -2,6 +2,8 @@ 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' @@ -44,7 +46,6 @@ 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', { @@ -754,8 +755,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() }