community.component.ts: Moved "loading twitter widget script conditionally" part inside communityInformationState.subscribe and added check if communityInfo not null/undefined.

This commit is contained in:
Konstantina Galouni 2021-11-08 17:41:25 +02:00
parent 4fd401297c
commit d5eba5c095
2 changed files with 12 additions and 11 deletions

View File

@ -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) {

@ -1 +1 @@
Subproject commit 0aa44646b1c57974569aadcaa4ba67a8a5028ef4
Subproject commit fcf29d801ff0c580f55de4328e1198307cee3166