Revert "fixup! chore(calendarObjectsStore)!: Start migration to Pinia"

This reverts commit 65d9da72c3.
This commit is contained in:
Grigory Vodyanov 2024-04-25 12:58:05 +02:00
parent 65d9da72c3
commit 11b519bbd4
3 changed files with 13 additions and 36 deletions

View File

@ -65,8 +65,6 @@ import {
import CalendarQuestionIcon from 'vue-material-design-icons/CalendarQuestion.vue'
import { showError, showSuccess } from '@nextcloud/dialogs'
import logger from '../../utils/logger.js'
import { mapStores } from 'pinia'
import useCalendarObjectInstanceStore from '../../store/calendarObjectInstance.js'
export default {
name: 'InvitationResponseButtons',
@ -93,18 +91,18 @@ export default {
data() {
return {
loading: false,
attendeeCopy: this.attendee,
}
},
computed: {
...mapStores(useCalendarObjectInstanceStore),
isAccepted() {
return this.attendee.participationStatus === 'ACCEPTED'
return this.attendeeCopy.participationStatus === 'ACCEPTED'
},
isDeclined() {
return this.attendee.participationStatus === 'DECLINED'
return this.attendeeCopy.participationStatus === 'DECLINED'
},
isTentative() {
return this.attendee.participationStatus === 'TENTATIVE'
return this.attendeeCopy.participationStatus === 'TENTATIVE'
},
},
methods: {
@ -144,9 +142,8 @@ export default {
async setParticipationStatus(participationStatus) {
this.loading = true
try {
this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri).attendeeProperty.participationStatus = participationStatus
this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri).participationStatus = participationStatus
this.attendeeCopy.attendeeProperty.participationStatus = participationStatus
this.attendeeCopy.participationStatus = participationStatus
// TODO: What about recurring events? Add new buttons like "Accept this and all future"?
// Currently, this will only accept a single occurrence.
await this.$store.dispatch('saveCalendarObjectInstance', {

View File

@ -117,8 +117,6 @@ import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import ChevronUp from 'vue-material-design-icons/ChevronUp.vue'
import Delete from 'vue-material-design-icons/Delete.vue'
import { mapStores } from 'pinia'
import useCalendarObjectInstanceStore from '../../../store/calendarObjectInstance.js'
export default {
name: 'InviteesListItem',
@ -158,7 +156,6 @@ export default {
}
},
computed: {
...mapStores(useCalendarObjectInstanceStore),
/**
* @return {string}
*/
@ -220,13 +217,9 @@ export default {
* Toggles the RSVP flag of the attendee
*/
toggleRSVP() {
const oldRSVP = this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri)
.attendeeProperty.rsvp
this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri)
.attendeeProperty.rsvp = !oldRSVP
this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri)
.rsvp = !oldRSVP
this.$store.commit('toggleAttendeeRSVP', {
attendee: this.attendee,
})
},
/**
* Updates the role of the attendee
@ -234,10 +227,10 @@ export default {
* @param {string} role The new role of the attendee
*/
changeRole(role) {
this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri)
.attendeeProperty.role = role
this.calendarObjectInstanceStore.calendarObjectInstance.attendees.where((attendee) => attendee.uri === this.attendee.uri)
.role = role
this.$store.commit('changeAttendeesRole', {
attendee: this.attendee,
role,
})
},
/**
* Removes an attendee from the event

View File

@ -364,19 +364,6 @@ export defineStore('calendarObjectInstance', {
calendarObjectInstance.attendees.splice(index, 1)
}
},
/**
* Changes an attendees' role
*
* @param {object} data The destructuring object
* @param {object} data.attendeeUri The attendeeUri object
* @param {string} data.role New role of attendee
*/
changeAttendeesRole({ attendeeUri, role }) {
let referenceAttendee = this.calendarObjectInstance.attendees.where((attendee) => attendee.uri === attendeeUri)
referenceAttendee.attendeeProperty.role = role
referenceAttendee.role = role
},
},
})