Bläddra i källkod

Fix check for current user at card details.

Thanks to xet7 !
Lauri Ojansivu 2 år sedan
förälder
incheckning
68e4e6f049
1 ändrade filer med 13 tillägg och 11 borttagningar
  1. 13 11
      client/components/cards/cardDetails.js

+ 13 - 11
client/components/cards/cardDetails.js

@@ -1579,17 +1579,19 @@ EscapeActions.register(
   () => {
     // if card description diverges from database due to editing
     // ask user whether changes should be applied
-    if (currentUser.profile.rescueCardDescription == true) {
-      currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
-      if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription())) {
-        if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) {
-          Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value);
-          // Save it!
-          console.log(document.getElementsByClassName("editor js-new-description-input").item(0).value);
-          console.log("current description", Utils.getCurrentCard().getDescription());
-        } else {
-          // Do nothing!
-          console.log('Description changes were not saved to the database.');
+    if (Meteor.user()) {
+      if (Meteor.user().profile.rescueCardDescription == true) {
+        currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
+        if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription())) {
+          if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) {
+            Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value);
+            // Save it!
+            console.log(document.getElementsByClassName("editor js-new-description-input").item(0).value);
+            console.log("current description", Utils.getCurrentCard().getDescription());
+          } else {
+            // Do nothing!
+            console.log('Description changes were not saved to the database.');
+          }
         }
       }
     }