biome format --write

This commit is contained in:
Henry Jameson 2026-01-06 16:22:52 +02:00
commit 9262e803ec
415 changed files with 54076 additions and 17419 deletions

View file

@ -9,91 +9,114 @@ import { useListsStore } from 'src/stores/lists'
library.add(faChevronRight)
const UserListMenu = {
props: [
'user'
],
data () {
props: ['user'],
data() {
return {}
},
components: {
DialogModal,
Popover
Popover,
},
created () {
created() {
this.$store.dispatch('fetchUserInLists', this.user.id)
},
computed: {
...mapState(useListsStore, {
allLists: store => store.allLists
allLists: (store) => store.allLists,
}),
inListsSet () {
return new Set(this.user.inLists.map(x => x.id))
inListsSet() {
return new Set(this.user.inLists.map((x) => x.id))
},
lists () {
lists() {
if (!this.user.inLists) return []
return this.allLists.map(list => ({
return this.allLists.map((list) => ({
...list,
inList: this.inListsSet.has(list.id)
inList: this.inListsSet.has(list.id),
}))
},
triggerAttrs () {
triggerAttrs() {
return {
class: 'menu-item dropdown-item -has-submenu'
class: 'menu-item dropdown-item -has-submenu',
}
}
},
},
methods: {
toggleList (listId) {
toggleList(listId) {
if (this.inListsSet.has(listId)) {
useListsStore().removeListAccount({ accountId: this.user.id, listId }).then((response) => {
if (!response.ok) { return }
this.$store.dispatch('fetchUserInLists', this.user.id)
})
useListsStore()
.removeListAccount({ accountId: this.user.id, listId })
.then((response) => {
if (!response.ok) {
return
}
this.$store.dispatch('fetchUserInLists', this.user.id)
})
} else {
useListsStore().addListAccount({ accountId: this.user.id, listId }).then((response) => {
if (!response.ok) { return }
this.$store.dispatch('fetchUserInLists', this.user.id)
})
useListsStore()
.addListAccount({ accountId: this.user.id, listId })
.then((response) => {
if (!response.ok) {
return
}
this.$store.dispatch('fetchUserInLists', this.user.id)
})
}
},
toggleRight (right) {
toggleRight(right) {
const store = this.$store
if (this.user.rights[right]) {
store.state.api.backendInteractor.deleteRight({ user: this.user, right }).then(response => {
if (!response.ok) { return }
store.commit('updateRight', { user: this.user, right, value: false })
})
store.state.api.backendInteractor
.deleteRight({ user: this.user, right })
.then((response) => {
if (!response.ok) {
return
}
store.commit('updateRight', {
user: this.user,
right,
value: false,
})
})
} else {
store.state.api.backendInteractor.addRight({ user: this.user, right }).then(response => {
if (!response.ok) { return }
store.commit('updateRight', { user: this.user, right, value: true })
})
store.state.api.backendInteractor
.addRight({ user: this.user, right })
.then((response) => {
if (!response.ok) {
return
}
store.commit('updateRight', { user: this.user, right, value: true })
})
}
},
toggleActivationStatus () {
toggleActivationStatus() {
this.$store.dispatch('toggleActivationStatus', { user: this.user })
},
deleteUserDialog (show) {
deleteUserDialog(show) {
this.showDeleteUserDialog = show
},
deleteUser () {
deleteUser() {
const store = this.$store
const user = this.user
const { id, name } = user
store.state.api.backendInteractor.deleteUser({ user })
.then(() => {
this.$store.dispatch('markStatusesAsDeleted', status => user.id === status.user.id)
const isProfile = this.$route.name === 'external-user-profile' || this.$route.name === 'user-profile'
const isTargetUser = this.$route.params.name === name || this.$route.params.id === id
if (isProfile && isTargetUser) {
window.history.back()
}
})
store.state.api.backendInteractor.deleteUser({ user }).then(() => {
this.$store.dispatch(
'markStatusesAsDeleted',
(status) => user.id === status.user.id,
)
const isProfile =
this.$route.name === 'external-user-profile' ||
this.$route.name === 'user-profile'
const isTargetUser =
this.$route.params.name === name || this.$route.params.id === id
if (isProfile && isTargetUser) {
window.history.back()
}
})
},
setToggled (value) {
setToggled(value) {
this.toggled = value
}
}
},
},
}
export default UserListMenu