Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Db/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ public function getStatusArray(): array {
'deletionDate' => $this->getDeletionDate(),
'archivedDate' => $this->getDeleted(),
'countParticipants' => $this->getIsAllowed(self::PERMISSION_POLL_RESULTS_VIEW) ? $this->getParticipantsCount() : 0,
'maxVotes' => $this->getVoteLimit(),
'maxOptionVotes' => $this->getOptionLimit(),
];
}
public function getConfigurationArray(): array {
Expand Down
9 changes: 2 additions & 7 deletions src/components/SideBar/SideBarTabComments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import CommentsIcon from 'vue-material-design-icons/CommentProcessing.vue'

import { usePollStore } from '../../stores/poll'
import { useCommentsStore } from '../../stores/comments'
import { Logger } from '../../helpers'

const pollStore = usePollStore()
const commentsStore = useCommentsStore()
Expand All @@ -41,12 +40,8 @@ onBeforeRouteLeave(() => {
})

watch(
[() => pollStore.permissions.comment, () => pollStore.configuration.anonymous],
([commentNew, commentOld], [anonymousNew, anonymousOld]) => {
Logger.debug('Configuration affecting comments changed', {
comment: `${commentOld} → ${commentNew}`,
anonymous: `${anonymousOld} → ${anonymousNew}`,
})
[() => pollStore.permissions.comment, () => pollStore.permissions.seeUsernames],
() => {
commentsStore.load()
},
)
Expand Down
2 changes: 2 additions & 0 deletions src/stores/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export const usePollStore = defineStore('poll', {
deletionDate: 0,
archivedDate: 0,
countParticipants: 0,
maxVotes: 0,
maxOptionVotes: 0,
},
currentUserStatus: {
groupInvitations: [],
Expand Down
2 changes: 2 additions & 0 deletions src/stores/poll.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export type PollStatus = {
deletionDate: number
archivedDate: number
countParticipants: number
maxVotes: number
maxOptionVotes: number
}

export type PollPermissions = {
Expand Down
40 changes: 13 additions & 27 deletions src/views/Vote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { useSubscriptionStore } from '../stores/subscription'

import type { CollapsibleProps } from '../components/Base/modules/Collapsible.vue'
import { Event } from '../Types'
import { Logger } from '../helpers'

const pollStore = usePollStore()
const optionsStore = useOptionsStore()
Expand Down Expand Up @@ -176,39 +175,26 @@ onUnmounted(() => {

watch(
[
() => pollStore.configuration.anonymous,
() => pollStore.configuration.maxVotesPerOption,
() => pollStore.configuration.maxVotesPerUser,
() => pollStore.configuration.hideBookedUp,
() => pollStore.permissions.seeUsernames,
() => pollStore.permissions.seeResults,
],
(
[anonymousNew, maxVotesPerOptionNew, maxVotesPerUserNew, hideBookedUpNew],
[anonymousOld, maxVotesPerOptionOld, maxVotesPerUserOld, hideBookedUpOld],
) => {
Logger.debug('Configuration affecting options changed', {
anonymous: `${anonymousNew} → ${anonymousOld}`,
maxVotesPerOptionNew: `${maxVotesPerOptionNew} → ${maxVotesPerOptionOld}`,
maxVotesPerUserNew: `${maxVotesPerUserNew} → ${maxVotesPerUserOld}`,
hideBookedUpNew: `${hideBookedUpNew} → ${hideBookedUpOld}`,
})
optionsStore.load()
([seeUsernamesNew, seeResultsNew], [seeUsernamesOld, seeResultsOld]) => {
if (seeResultsNew !== seeResultsOld || seeUsernamesNew !== seeUsernamesOld) {
optionsStore.load()
votesStore.load()
}
},
)

watch(
[
() => pollStore.configuration.anonymous,
() => pollStore.configuration.showResults,
],
([anonymousNew, showResultsNew], [anonymousOld, showResultsOld]) => {
Logger.debug('Configuration affecting votes changed', {
anonymous: `${anonymousOld} → ${anonymousNew}`,
showResults: `${showResultsOld} → ${showResultsNew}`,
})
emit(Event.TransitionsOff, 500)
votesStore.load()
[() => pollStore.status.maxOptionVotes, () => pollStore.status.maxVotes],
([maxOptionVotesNew, maxVotesNew], [maxOptionVotesOld, maxVotesOld]) => {
if (maxOptionVotesNew !== maxOptionVotesOld || maxVotesNew !== maxVotesOld) {
optionsStore.load()
}
},
)

const appClass = computed(() => [
pollStore.type,
pollStore.viewMode,
Expand Down