Browse Source

Fixes for notifications.

pull/523/head
Sebastian 6 years ago
parent
commit
010b18edc5
  1. 2
      frontend/app/shared/components/comments/comment.component.ts
  2. 7
      frontend/app/shared/state/comments.state.ts
  3. 1
      frontend/app/shell/pages/internal/notifications-menu.component.ts

2
frontend/app/shared/components/comments/comment.component.ts

@ -72,7 +72,7 @@ export class CommentComponent implements OnChanges {
} }
public delete() { public delete() {
if (!this.isDeletable) { if (!this.isDeletable && !this.canDelete) {
return; return;
} }

7
frontend/app/shared/state/comments.state.ts

@ -37,6 +37,7 @@ export class CommentsState extends State<Snapshot> {
private readonly commentsUrl: string, private readonly commentsUrl: string,
private readonly commentsService: CommentsService, private readonly commentsService: CommentsService,
private readonly dialogs: DialogService, private readonly dialogs: DialogService,
private readonly orderDescending = false,
initialVersion = -1 initialVersion = -1
) { ) {
super({ comments: [], version: new Version(initialVersion.toString()) }); super({ comments: [], version: new Version(initialVersion.toString()) });
@ -50,7 +51,11 @@ export class CommentsState extends State<Snapshot> {
for (const created of payload.createdComments) { for (const created of payload.createdComments) {
if (!comments.find(x => x.id === created.id)) { if (!comments.find(x => x.id === created.id)) {
comments = [...comments, created]; if (this.orderDescending) {
comments = [created, ...comments];
} else {
comments = [...comments, created];
}
} }
} }

1
frontend/app/shell/pages/internal/notifications-menu.component.ts

@ -55,6 +55,7 @@ export class NotificationsMenuComponent extends ResourceOwner implements OnInit
commentsUrl, commentsUrl,
commentsService, commentsService,
dialogs, dialogs,
true,
this.versionRead); this.versionRead);
} }

Loading…
Cancel
Save