Ver Fonte

Merge branch 'marc1006-minor_fixes'

Lauri Ojansivu há 5 anos atrás
pai
commit
2df29324e6

+ 4 - 3
client/components/activities/activities.js

@@ -151,8 +151,9 @@ BlazeComponent.extendComponent({
   },
 
   attachmentLink() {
-    const attachment = this.currentData().activity.attachment();
-    const link = attachment.link('original', '/');
+    const activity = this.currentData().activity;
+    const attachment = activity.attachment();
+    const link = attachment ? attachment.link('original', '/') : null;
     // trying to display url before file is stored generates js errors
     return (
       (attachment &&
@@ -166,7 +167,7 @@ BlazeComponent.extendComponent({
             attachment.name,
           ),
         )) ||
-      this.currentData().activity.attachmentName
+      activity.attachmentName
     );
   },
 

+ 8 - 1
client/components/cards/cardDetails.js

@@ -74,11 +74,18 @@ BlazeComponent.extendComponent({
 
   scrollParentContainer() {
     const cardPanelWidth = 510;
-    const bodyBoardComponent = this.parentComponent().parentComponent();
+    const parentComponent = this.parentComponent();
+    // TODO sometimes parentComponent is not available, maybe because it's not
+    // yet created?!
+    if (!parentComponent) return;
+    const bodyBoardComponent = parentComponent.parentComponent();
     //On Mobile View Parent is Board, Not Board Body. I cant see how this funciton should work then.
     if (bodyBoardComponent === null) return;
     const $cardView = this.$(this.firstNode());
     const $cardContainer = bodyBoardComponent.$('.js-swimlanes');
+    // TODO sometimes cardContainer is not available, maybe because it's not yet
+    // created?!
+    if (!$cardContainer) return;
     const cardContainerScroll = $cardContainer.scrollLeft();
     const cardContainerWidth = $cardContainer.width();
 

+ 1 - 0
models/cards.js

@@ -535,6 +535,7 @@ Cards.helpers({
   },
 
   cover() {
+    if (!this.coverId) return false;
     const cover = Attachments.findOne(this.coverId);
     // if we return a cover before it is fully stored, we will get errors when we try to display it
     // todo XXX we could return a default "upload pending" image in the meantime?