Merge branch 'marc1006-minor_fixes'

This commit is contained in:
Lauri Ojansivu 2020-05-24 18:51:12 +03:00
commit 2df29324e6
3 changed files with 13 additions and 4 deletions

View file

@ -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
);
},

View file

@ -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();

View file

@ -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?