Just include comments on document object

This commit is contained in:
shamoon
2023-03-17 15:08:12 -07:00
parent 9d17727cb6
commit 78cb8cff69
14 changed files with 147 additions and 85 deletions

View File

@@ -172,9 +172,9 @@
</li>
<li [ngbNavItem]="DocumentDetailNavIDs.Comments" *ngIf="commentsEnabled">
<a ngbNavLink i18n>Comments <span *ngIf="document?.n_comments" class="badge text-bg-secondary ms-1">{{document.n_comments}}</span></a>
<a ngbNavLink i18n>Comments <span *ngIf="document?.comments.length" class="badge text-bg-secondary ms-1">{{document.comments.length}}</span></a>
<ng-template ngbNavContent>
<app-document-comments [documentId]="documentId" (updated)="commentsUpdated($event)"></app-document-comments>
<app-document-comments [documentId]="documentId" [comments]="document?.comments" (updated)="commentsUpdated($event)"></app-document-comments>
</ng-template>
</li>

View File

@@ -42,6 +42,7 @@ import {
} from 'src/app/services/permissions.service'
import { PaperlessUser } from 'src/app/data/paperless-user'
import { UserService } from 'src/app/services/rest/user.service'
import { PaperlessDocumentComment } from 'src/app/data/paperless-document-comment'
enum DocumentDetailNavIDs {
Details = 1,
@@ -667,8 +668,8 @@ export class DocumentDetailComponent
)
}
commentsUpdated(n_comments: number) {
this.document.n_comments = n_comments
commentsUpdated(comments: PaperlessDocumentComment[]) {
this.document.comments = comments
this.openDocumentService.refreshDocument(this.documentId)
}