P3 fixes
This commit is contained in:
parent
3b856e94da
commit
5788d3e8ec
10 changed files with 38 additions and 33 deletions
|
|
@ -5,9 +5,9 @@ import Popover from 'src/components/popover/popover.vue'
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
import { useUsersStore } from 'src/stores/users.js'
|
import { useUsersStore } from 'src/stores/users.js'
|
||||||
|
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faFilter, faFont, faWrench } from '@fortawesome/free-solid-svg-icons'
|
import { faFilter, faFont, faWrench } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
@ -28,7 +28,7 @@ const QuickFilterSettings = {
|
||||||
path: 'replyVisibility',
|
path: 'replyVisibility',
|
||||||
value: visibility,
|
value: visibility,
|
||||||
})
|
})
|
||||||
useStatusesStore().requireReloadAll()
|
useTimelinesStore().requireReloadAll()
|
||||||
},
|
},
|
||||||
openTab(tab) {
|
openTab(tab) {
|
||||||
useInterfaceStore().openSettingsModalTab(tab)
|
useInterfaceStore().openSettingsModalTab(tab)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import UnitSetting from '../helpers/unit_setting.vue'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||||
|
|
||||||
const ClutterTab = {
|
const ClutterTab = {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -36,7 +36,7 @@ const ClutterTab = {
|
||||||
// Updating nested properties
|
// Updating nested properties
|
||||||
watch: {
|
watch: {
|
||||||
replyVisibility() {
|
replyVisibility() {
|
||||||
useStatusesStore().requireReloadAll()
|
useTimelinesStore().requireReloadAll()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import UnitSetting from '../helpers/unit_setting.vue'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -266,7 +266,7 @@ const FilteringTab = {
|
||||||
// Updating nested properties
|
// Updating nested properties
|
||||||
watch: {
|
watch: {
|
||||||
replyVisibility() {
|
replyVisibility() {
|
||||||
useStatusesStore().requireReloadAll()
|
useTimelinesStore().requireReloadAll()
|
||||||
},
|
},
|
||||||
muteFiltersObject() {
|
muteFiltersObject() {
|
||||||
this.muteFiltersDraftObject = cloneDeep(
|
this.muteFiltersDraftObject = cloneDeep(
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,12 @@ const Timeline = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
statusesToDisplay() {
|
statusesToDisplay() {
|
||||||
if (!this.virtualScrollingEnabled) return this.visibleStatusIds
|
if (!this.virtualScrollingEnabled) {
|
||||||
|
return new Set(
|
||||||
|
this.filteredVisibleStatuses.map(({ id }) => id),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const amount = this.timeline.visibleStatusIds.size
|
const amount = this.timeline.visibleStatusIds.size
|
||||||
const statusesPerSide = Math.ceil(Math.max(3, window.innerHeight / 80))
|
const statusesPerSide = Math.ceil(Math.max(3, window.innerHeight / 80))
|
||||||
const min = Math.max(0, this.virtualScrollIndex - statusesPerSide)
|
const min = Math.max(0, this.virtualScrollIndex - statusesPerSide)
|
||||||
|
|
|
||||||
|
|
@ -1634,7 +1634,6 @@
|
||||||
"no_statuses": "No statuses",
|
"no_statuses": "No statuses",
|
||||||
"socket_reconnected": "Realtime connection established",
|
"socket_reconnected": "Realtime connection established",
|
||||||
"socket_disconnected": "Realtime connection unavaialable",
|
"socket_disconnected": "Realtime connection unavaialable",
|
||||||
"socket_closed": "Realtime connection closed",
|
|
||||||
"socket_broke": "Realtime connection lost: CloseEvent code {0}",
|
"socket_broke": "Realtime connection lost: CloseEvent code {0}",
|
||||||
"quick_view_settings": "Quick view settings",
|
"quick_view_settings": "Quick view settings",
|
||||||
"quick_filter_settings": "Quick filter settings",
|
"quick_filter_settings": "Quick filter settings",
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ const notificationsFetcher = (credentials) => {
|
||||||
const notifications = response.data
|
const notifications = response.data
|
||||||
if (older && notifications.length === 0) bottomedOut.value = true
|
if (older && notifications.length === 0) bottomedOut.value = true
|
||||||
|
|
||||||
useNotificationsStore().addNewNotifications(response)
|
useNotificationsStore().addNewNotifications(response, older)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (
|
if (
|
||||||
error.statusCode === 400 &&
|
error.statusCode === 400 &&
|
||||||
|
|
@ -78,7 +78,7 @@ const notificationsFetcher = (credentials) => {
|
||||||
|
|
||||||
args.timeline = 'notifications'
|
args.timeline = 'notifications'
|
||||||
if (older) {
|
if (older) {
|
||||||
if (timelineData.minId !== Number.POSITIVE_INFINITY) {
|
if (timelineData.minId !== '') {
|
||||||
args.maxId = timelineData.minId
|
args.maxId = timelineData.minId
|
||||||
}
|
}
|
||||||
return await fetchNotifications({ args, older })
|
return await fetchNotifications({ args, older })
|
||||||
|
|
@ -86,7 +86,7 @@ const notificationsFetcher = (credentials) => {
|
||||||
// fetch new notifications
|
// fetch new notifications
|
||||||
if (
|
if (
|
||||||
sinceId === undefined &&
|
sinceId === undefined &&
|
||||||
timelineData.maxId !== Number.POSITIVE_INFINITY
|
timelineData.maxId !== ''
|
||||||
) {
|
) {
|
||||||
args.sinceId = timelineData.maxId
|
args.sinceId = timelineData.maxId
|
||||||
} else if (sinceId !== null) {
|
} else if (sinceId !== null) {
|
||||||
|
|
|
||||||
|
|
@ -134,14 +134,7 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
1001, // Going away
|
1001, // Going away
|
||||||
])
|
])
|
||||||
const { code } = closeEvent.original
|
const { code } = closeEvent.original
|
||||||
if (intendedCodes.has(code)) {
|
if (!intendedCodes.has(code)) {
|
||||||
this.pushGlobalNotice({
|
|
||||||
level: 'success',
|
|
||||||
messageKey: 'timeline.socket_closed',
|
|
||||||
messageArgs: [code],
|
|
||||||
timeout: 5000,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.pushGlobalNotice({
|
this.pushGlobalNotice({
|
||||||
level: 'error',
|
level: 'error',
|
||||||
messageKey: 'timeline.socket_broke',
|
messageKey: 'timeline.socket_broke',
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ export const useStreamingStore = defineStore('streaming', {
|
||||||
},
|
},
|
||||||
stopSocket() {
|
stopSocket() {
|
||||||
this.socket.close()
|
this.socket.close()
|
||||||
|
this.socket = null
|
||||||
this.state = WSConnectionStatus.CLOSED
|
this.state = WSConnectionStatus.CLOSED
|
||||||
this.retrying = false
|
this.retrying = false
|
||||||
this.retryMultiplier = 1
|
this.retryMultiplier = 1
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ export const ARGUMENT_MAP = {
|
||||||
user: 'userId',
|
user: 'userId',
|
||||||
userPinned: 'userId',
|
userPinned: 'userId',
|
||||||
media: 'userId',
|
media: 'userId',
|
||||||
|
favorites: 'userId',
|
||||||
}
|
}
|
||||||
|
|
||||||
const TIMELINES = new Set([
|
const TIMELINES = new Set([
|
||||||
|
|
@ -180,7 +181,7 @@ export const useTimelinesStore = defineStore('timelines', {
|
||||||
timeline.socket.handlers
|
timeline.socket.handlers
|
||||||
timeline.socket.et.removeEventListener('open', openHandler)
|
timeline.socket.et.removeEventListener('open', openHandler)
|
||||||
timeline.socket.et.removeEventListener('close', closeHandler)
|
timeline.socket.et.removeEventListener('close', closeHandler)
|
||||||
timeline.socket.et.removeEventListener('message', messageHandler)
|
timeline.socket.et.removeEventListener('update', messageHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
this[timelineName] = emptyTl(timelineName)
|
this[timelineName] = emptyTl(timelineName)
|
||||||
|
|
@ -267,8 +268,6 @@ export const useTimelinesStore = defineStore('timelines', {
|
||||||
if (statuses.length === 0) return
|
if (statuses.length === 0) return
|
||||||
const timeline = this[timelineName]
|
const timeline = this[timelineName]
|
||||||
|
|
||||||
this.populateRepeats(timeline, repeats)
|
|
||||||
|
|
||||||
// This makes sure that user timeline won't get data meant for other
|
// This makes sure that user timeline won't get data meant for other
|
||||||
// user. I.e. opening different user profiles makes request which could
|
// user. I.e. opening different user profiles makes request which could
|
||||||
// return data late after user already viewing different user profile
|
// return data late after user already viewing different user profile
|
||||||
|
|
@ -279,6 +278,8 @@ export const useTimelinesStore = defineStore('timelines', {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.populateRepeats(timeline, repeats)
|
||||||
|
|
||||||
const filtered = statuses.filter((id) => !timeline.statusIds.has(id))
|
const filtered = statuses.filter((id) => !timeline.statusIds.has(id))
|
||||||
if (older) {
|
if (older) {
|
||||||
timeline.order.push(...filtered)
|
timeline.order.push(...filtered)
|
||||||
|
|
|
||||||
|
|
@ -276,15 +276,21 @@ export const useUsersStore = defineStore('users', {
|
||||||
|
|
||||||
const result = await promise
|
const result = await promise
|
||||||
|
|
||||||
if (result) {
|
try {
|
||||||
const { id, screen_name } = result
|
if (result) {
|
||||||
|
const { id, screen_name } = result
|
||||||
|
|
||||||
// Save promise for future use
|
// Save promise for future use
|
||||||
this.fetchesIds.set(id, promise)
|
this.fetchesIds.set(id, promise)
|
||||||
this.fetchesNames.set(screen_name, promise)
|
this.fetchesNames.set(screen_name, promise)
|
||||||
return this.users.get(id)
|
return this.users.get(id)
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Failed fetching user ${identifier}`, e)
|
||||||
|
map.delete(identifier)
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async fetchUser(id) {
|
async fetchUser(id) {
|
||||||
|
|
@ -518,7 +524,7 @@ export const useUsersStore = defineStore('users', {
|
||||||
|
|
||||||
/// Mute
|
/// Mute
|
||||||
muteUser(id, expiresIn = 0) {
|
muteUser(id, expiresIn = 0) {
|
||||||
const predictedRelationship = this.relationships[id] || { id }
|
const predictedRelationship = this.relationships.get(id) || { id }
|
||||||
predictedRelationship.muting = true
|
predictedRelationship.muting = true
|
||||||
this.updateUserRelationships({
|
this.updateUserRelationships({
|
||||||
optimism: true,
|
optimism: true,
|
||||||
|
|
@ -537,7 +543,7 @@ export const useUsersStore = defineStore('users', {
|
||||||
return Promise.all(data.map((d) => this.muteUser(d)))
|
return Promise.all(data.map((d) => this.muteUser(d)))
|
||||||
},
|
},
|
||||||
unmuteUser(id) {
|
unmuteUser(id) {
|
||||||
const predictedRelationship = this.relationships[id] || { id }
|
const predictedRelationship = this.relationships.get(id) || { id }
|
||||||
predictedRelationship.muting = false
|
predictedRelationship.muting = false
|
||||||
this.updateUserRelationships({
|
this.updateUserRelationships({
|
||||||
optimism: true,
|
optimism: true,
|
||||||
|
|
@ -554,7 +560,7 @@ export const useUsersStore = defineStore('users', {
|
||||||
|
|
||||||
/// Block
|
/// Block
|
||||||
blockUser(id, expiresIn = 0) {
|
blockUser(id, expiresIn = 0) {
|
||||||
const predictedRelationship = this.relationships[id] || { id }
|
const predictedRelationship = this.relationships.get(id) || { id }
|
||||||
this.updateUserRelationships({
|
this.updateUserRelationships({
|
||||||
optimism: true,
|
optimism: true,
|
||||||
data: [predictedRelationship],
|
data: [predictedRelationship],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue