From d5eba5c0956df508afa1a050acccaab82190e9ae Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 8 Nov 2021 17:41:25 +0200 Subject: [PATCH] community.component.ts: Moved "loading twitter widget script conditionally" part inside communityInformationState.subscribe and added check if communityInfo not null/undefined. --- src/app/community/community.component.ts | 21 +++++++++++---------- src/app/openaireLibrary | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index afda8cc..67a459b 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -226,22 +226,23 @@ export class CommunityComponent { this.subs.push(this.config.communityInformationState.subscribe( res => { this.communityInfo = res; + + // loading twitter widget script conditionally + if (properties.environment == "development") { + if (this.communityInfo && this.communityInfo.twitterAccount) { + let script = this._renderer2.createElement('script'); + script.charset = "utf-8"; + script.src = "https://platform.twitter.com/widgets.js"; + this._renderer2.appendChild(this._document.body, script); + } + } }, error => { //console.log(error) this.handleError("Error getting community with id: " + this.communityId, error); } )); - - // loading twitter widget script conditionally - if(properties.environment == "development") { - if(this.communityInfo.twitterAccount) { - let script = this._renderer2.createElement('script'); - script.charset = "utf-8"; - script.src = "https://platform.twitter.com/widgets.js"; - this._renderer2.appendChild(this._document.body, script); - } - } + } private searchPublications(page: number, size: number) { diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 0aa4464..fcf29d8 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 0aa44646b1c57974569aadcaa4ba67a8a5028ef4 +Subproject commit fcf29d801ff0c580f55de4328e1198307cee3166