From 463db21de569874d7a0b0540d5f89deb6aedee95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e?= <tpoussard@neogeo.fr>
Date: Wed, 20 Jul 2022 18:10:11 +0200
Subject: [PATCH] fix comment not sent & add info message for empty linked
 features

---
 src/components/Feature/Detail/FeatureComments.vue | 8 +++++---
 src/components/Feature/Detail/FeatureTable.vue    | 7 +++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/components/Feature/Detail/FeatureComments.vue b/src/components/Feature/Detail/FeatureComments.vue
index a6d63377..c47c5ec5 100644
--- a/src/components/Feature/Detail/FeatureComments.vue
+++ b/src/components/Feature/Detail/FeatureComments.vue
@@ -207,10 +207,12 @@ export default {
       'user',
       'isOnline',
     ]),
-
     ...mapGetters([
       'permissions',
     ]),
+    ...mapState('feature', [
+      'currentFeature',
+    ]),
 
     DJANGO_BASE_URL() {
       return this.$store.state.configuration.VUE_APP_DJANGO_BASE;
@@ -231,14 +233,14 @@ export default {
       if (this.validateForm()) {
         featureAPI
           .postComment({
-            featureId: this.$route.params.slug_signal,
+            featureId: this.currentFeature.feature_id,
             comment: this.comment_form.comment.value,
           })
           .then((response) => {
             if (response && this.comment_form.attachment_file.file) {
               featureAPI
                 .postCommentAttachment({
-                  featureId: this.$route.params.slug_signal,
+                  featureId: this.currentFeature.feature_id,
                   file: this.comment_form.attachment_file.file,
                   fileName: this.comment_form.attachment_file.fileName,
                   title: this.comment_form.attachment_file.title,
diff --git a/src/components/Feature/Detail/FeatureTable.vue b/src/components/Feature/Detail/FeatureTable.vue
index fd124755..ef36f677 100644
--- a/src/components/Feature/Detail/FeatureTable.vue
+++ b/src/components/Feature/Detail/FeatureTable.vue
@@ -115,6 +115,13 @@
             {{ link.feature_to.created_on }})
           </td>
         </tr>
+        <tr v-if="linked_features.length === 0">
+          <td>
+            <em>
+              Aucune liaison associée au signalement.
+            </em>
+          </td>
+        </tr>
       </tbody>
     </table>
   </div>
-- 
GitLab