moderately usable state
This commit is contained in:
parent
d77163cf91
commit
d0c3eafa84
15 changed files with 570 additions and 338 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useStreamingStore } from 'src/stores/streaming.js'
|
||||
|
|
@ -240,6 +239,10 @@ export const useStatusesStore = defineStore('statuses', {
|
|||
const status = this.allStatuses.get(id)
|
||||
status.emoji_reactions = emojiReactions
|
||||
},
|
||||
updateStatusWithPoll(id, poll) {
|
||||
const status = this.allStatuses.get(id)
|
||||
status.poll = poll
|
||||
},
|
||||
|
||||
// Actions
|
||||
requestInteract({ name, id, optimisticCall, apiCall, argument, value }) {
|
||||
|
|
@ -524,49 +527,20 @@ export const useStatusesStore = defineStore('statuses', {
|
|||
|
||||
// For when blocking a user
|
||||
wipeUserStatuses(userId) {
|
||||
const removed = new Set()
|
||||
this.allStatuses.forEach((status) => {
|
||||
if (status.user.id === userId) {
|
||||
this.allStatuses.delete(status.id)
|
||||
|
||||
removed.add(status.id)
|
||||
}
|
||||
})
|
||||
return removed
|
||||
},
|
||||
|
||||
// Search
|
||||
search({ q, resolve, limit, offset, following, type }) {
|
||||
return search2({
|
||||
q,
|
||||
resolve,
|
||||
limit,
|
||||
offset,
|
||||
following,
|
||||
type,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
const { data, ...rest } = result
|
||||
useUsersStore().addNewUsers({
|
||||
...rest,
|
||||
data: data.accounts,
|
||||
})
|
||||
|
||||
useUsersStore().addNewUsers({
|
||||
...rest,
|
||||
data: data.statuses.map((s) => s.user).filter(Boolean),
|
||||
})
|
||||
|
||||
this.addNewStatuses({
|
||||
statuses: data.statuses,
|
||||
})
|
||||
|
||||
data.statuses = data.statuses.map((s) => this.allStatuses.get(s.id))
|
||||
return data
|
||||
})
|
||||
},
|
||||
// Misc
|
||||
setVirtualHeight({ statusId, height }) {
|
||||
this.allStatuses.get(statusId).virtualHeight = height
|
||||
},
|
||||
updateStatusWithPoll({ id, poll }) {
|
||||
const status = this.allStatuses.get(id)
|
||||
status.poll = poll
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue