move scrobblesAvailable to instance capabilities store
This commit is contained in:
parent
1e93e0a9c3
commit
c2f5840a02
2 changed files with 4 additions and 3 deletions
|
|
@ -16,6 +16,7 @@ import {
|
||||||
import apiService from '../services/api/api.service.js'
|
import apiService from '../services/api/api.service.js'
|
||||||
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
|
|
||||||
const emptyTl = (userId = 0) => ({
|
const emptyTl = (userId = 0) => ({
|
||||||
statuses: [],
|
statuses: [],
|
||||||
|
|
@ -41,7 +42,6 @@ export const defaultState = () => ({
|
||||||
conversationsObject: {},
|
conversationsObject: {},
|
||||||
maxId: 0,
|
maxId: 0,
|
||||||
favorites: new Set(),
|
favorites: new Set(),
|
||||||
pleromaScrobblesAvailable: true, // not reported in nodeinfo
|
|
||||||
timelines: {
|
timelines: {
|
||||||
mentions: emptyTl(),
|
mentions: emptyTl(),
|
||||||
public: emptyTl(),
|
public: emptyTl(),
|
||||||
|
|
@ -115,7 +115,7 @@ const sortTimeline = (timeline) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLatestScrobble = (state, user) => {
|
const getLatestScrobble = (state, user) => {
|
||||||
const scrobblesSupport = state.pleromaScrobblesAvailable
|
const scrobblesSupport = useInstanceCapabilitiesStore().pleromaScrobblesAvailable
|
||||||
|
|
||||||
if (!scrobblesSupport || !user.name || user.id === 'undefined') {
|
if (!scrobblesSupport || !user.name || user.id === 'undefined') {
|
||||||
return
|
return
|
||||||
|
|
@ -134,7 +134,7 @@ const getLatestScrobble = (state, user) => {
|
||||||
.fetchScrobbles({ accountId: user.id })
|
.fetchScrobbles({ accountId: user.id })
|
||||||
.then((scrobbles) => {
|
.then((scrobbles) => {
|
||||||
if (scrobbles?.error) {
|
if (scrobbles?.error) {
|
||||||
state.pleromaScrobblesAvailable = false
|
useInstanceCapabilitiesStore().set('pleromaScrobblesAvailable', false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ const defaultState = {
|
||||||
tagPolicyAvailable: false,
|
tagPolicyAvailable: false,
|
||||||
pollsAvailable: false,
|
pollsAvailable: false,
|
||||||
localBubble: false, // Akkoma
|
localBubble: false, // Akkoma
|
||||||
|
scrobblesSupport: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useInstanceCapabilitiesStore = defineStore(
|
export const useInstanceCapabilitiesStore = defineStore(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue