From 6472c554edc3f17a15fa4212637925d2acbc736d Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 4 Mar 2022 14:22:25 +0100 Subject: [PATCH] accompanying course comment: more tentative to delete the comment --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 1 + .../public/vuejs/AccompanyingCourse/components/Comment.vue | 2 +- .../Resources/public/vuejs/AccompanyingCourse/store/index.js | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 4d0c4895e..bd3211c5d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -261,6 +261,7 @@ class AccompanyingPeriod implements * cascade={"persist"}, * ) * @Groups({"read"}) + * @ORM\JoinColumn(onDelete="SET NULL") */ private ?Comment $pinnedComment = null; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue index 0534551ba..fde1319d7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue @@ -107,7 +107,7 @@ export default { } }, removeComment() { - this.$store.dispatch('removePinnedComment', {}) + this.$store.dispatch('removePinnedComment', {id: this.pinnedComment.id}) .catch(({name, violations}) => { if (name === 'ValidationException' || name === 'AccessException') { violations.forEach((violation) => this.$toast.open({message: violation})); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index dd2588d48..5b196df10 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -342,8 +342,9 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou /** * Add/remove pinnedComment */ - removePinnedComment({ commit }) { //DOES NOT WORK - const body = {type: "accompanying_period_comment"}; + removePinnedComment({ commit }, payload) { //DOES NOT WORK + + const body = {type: "accompanying_period_comment", id: payload.id}; const url = `/api/1.0/person/accompanying-course/${id}/comment.json`; return makeFetch('DELETE', url, body)