diff --git a/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs b/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs index f76e2ed42..05696fd59 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs @@ -189,23 +189,22 @@ namespace Squidex.Areas.Api.Controllers.Users if (!string.IsNullOrWhiteSpace(url)) { - using (var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead)) - { - if (response.IsSuccessStatusCode) - { - var contentType = response.Content.Headers.ContentType.ToString(); + var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead); - var etag = response.Headers.ETag; + if (response.IsSuccessStatusCode) + { + var contentType = response.Content.Headers.ContentType.ToString(); - var result = new FileStreamResult(await response.Content.ReadAsStreamAsync(), contentType); + var etag = response.Headers.ETag; - if (!string.IsNullOrWhiteSpace(etag?.Tag)) - { - result.EntityTag = new EntityTagHeaderValue(etag.Tag, etag.IsWeak); - } + var result = new FileStreamResult(await response.Content.ReadAsStreamAsync(), contentType); - return result; + if (!string.IsNullOrWhiteSpace(etag?.Tag)) + { + result.EntityTag = new EntityTagHeaderValue(etag.Tag, etag.IsWeak); } + + return result; } } } diff --git a/frontend/app/features/content/pages/comments/comments-page.component.html b/frontend/app/features/content/pages/comments/comments-page.component.html index a1f6f2059..5a63794b5 100644 --- a/frontend/app/features/content/pages/comments/comments-page.component.html +++ b/frontend/app/features/content/pages/comments/comments-page.component.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/frontend/app/features/content/pages/comments/comments-page.component.ts b/frontend/app/features/content/pages/comments/comments-page.component.ts index 10be2ca86..5a31bf70d 100644 --- a/frontend/app/features/content/pages/comments/comments-page.component.ts +++ b/frontend/app/features/content/pages/comments/comments-page.component.ts @@ -5,24 +5,20 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { allParams } from '@app/shared'; +import { map } from 'rxjs/operators'; @Component({ selector: 'sqx-comments-page', styleUrls: ['./comments-page.component.scss'], templateUrl: './comments-page.component.html' }) -export class CommentsPageComponent implements OnInit { - public commentsId: string; +export class CommentsPageComponent { + public commentsId = this.route.parent!.params.pipe(map(x => x['contentId'])); constructor( private readonly route: ActivatedRoute ) { } - - public ngOnInit() { - this.commentsId = allParams(this.route)['contentId']; - } } \ No newline at end of file diff --git a/frontend/app/shared/components/comments/comments.component.ts b/frontend/app/shared/components/comments/comments.component.ts index 53b16d7d3..0e092d7e3 100644 --- a/frontend/app/shared/components/comments/comments.component.ts +++ b/frontend/app/shared/components/comments/comments.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { ChangeDetectorRef, Component, ElementRef, Input, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; +import { ChangeDetectorRef, Component, ElementRef, Input, OnChanges, QueryList, ViewChild, ViewChildren } from '@angular/core'; import { FormBuilder } from '@angular/forms'; import { Router } from '@angular/router'; import { AppsState, AuthService, CommentDto, CommentsService, CommentsState, ContributorsState, DialogService, ResourceOwner, UpsertCommentForm } from '@app/shared/internal'; @@ -19,7 +19,7 @@ import { CommentComponent } from './comment.component'; styleUrls: ['./comments.component.scss'], templateUrl: './comments.component.html' }) -export class CommentsComponent extends ResourceOwner implements OnInit { +export class CommentsComponent extends ResourceOwner implements OnChanges { @ViewChild('commentsList', { static: false }) public commentsList: ElementRef; @@ -52,7 +52,7 @@ export class CommentsComponent extends ResourceOwner implements OnInit { this.userToken = authService.user!.token; } - public ngOnInit() { + public ngOnChanges() { this.contributorsState.load(); this.commentsUrl = `apps/${this.appsState.appName}/comments/${this.commentsId}`;