From 219ef9dd1d8e916ea4b1f843021b879c10be3418 Mon Sep 17 00:00:00 2001 From: monikahedman Date: Fri, 23 Aug 2019 22:32:33 -0400 Subject: it is PRETTY --- src/client/views/linking/LinkFollowBox.tsx | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/client/views/linking/LinkFollowBox.tsx b/src/client/views/linking/LinkFollowBox.tsx index f78446771..da04b1292 100644 --- a/src/client/views/linking/LinkFollowBox.tsx +++ b/src/client/views/linking/LinkFollowBox.tsx @@ -58,36 +58,18 @@ export class LinkFollowBox extends React.Component { () => LinkFollowBox.destinationDoc, async newLinkDestination => { if (LinkFollowBox.destinationDoc && this.sourceView && this.sourceView.props.ContainingCollectionView) { - let colView = this.sourceView.props.ContainingCollectionView; - let colDoc = colView.props.Document; - let shouldReturn = true; + let colDoc = this.sourceView.props.ContainingCollectionView.props.Document; + runInAction(() => { this.canPan = false; }); if (colDoc.viewType && colDoc.viewType === 1) { //this means its in a freeform collection let docs = Cast(colDoc.data, listSpec(Doc), []); let aliases = await SearchUtil.GetViewsOfDocument(Doc.GetProto(LinkFollowBox.destinationDoc)); aliases.forEach(alias => { - let docs2 = docs; - let res = docs2.filter(doc => doc === alias); - if (res.length > 0) { - runInAction(() => { - this.canPan = true; - shouldReturn = false; - }); - } + if (docs.filter(doc => doc === alias).length > 0) { runInAction(() => { this.canPan = true; }); } }); - - if (shouldReturn) { - runInAction(() => { this.canPan = false; }); - } - } - else { - runInAction(() => { this.canPan = false; }); } } - else { - runInAction(() => { this.canPan = false; }); - } } ); } -- cgit v1.2.3-70-g09d2