diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index 186200ecc..4f15d4217 100644 --- a/client/components/activities/activities.js +++ b/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 ); }, diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 441068b05..11e010d47 100644 --- a/client/components/cards/cardDetails.js +++ b/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(); diff --git a/models/cards.js b/models/cards.js index f4bb464c8..757772f33 100644 --- a/models/cards.js +++ b/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?