From bbeedb81acbff4f158491bd079e72d4869201255 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Fri, 30 Oct 2020 18:16:08 +0100
Subject: [PATCH] FEAT #14973 TIME 0:30 fix unsign button

---
 src/frontend/app/viewer/document-viewer.component.html | 2 +-
 src/frontend/app/viewer/document-viewer.component.ts   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/frontend/app/viewer/document-viewer.component.html b/src/frontend/app/viewer/document-viewer.component.html
index 8a1379f3cbf..8d2dd45bb5c 100644
--- a/src/frontend/app/viewer/document-viewer.component.html
+++ b/src/frontend/app/viewer/document-viewer.component.html
@@ -132,7 +132,7 @@
     <mat-icon style="height:auto;font-size:20px;" class="fas fa-check"></mat-icon>
 </button>
 <button mat-raised-button 
-    *ngIf="(!isDocModified && mode === 'mainDocument' && resId !== null && !functions.empty(file.subinfos) && file.subinfos.signedDocVersions && (privilegeService.hasCurrentUserPrivilege('sign_document') || this.headerService.user.id == file.creatorId)) && !hideTools" 
+    *ngIf="(!isDocModified && mode === 'mainDocument' && resId !== null && !functions.empty(file.subinfos) && file.subinfos.signedDocVersions && this.headerService.user.id == file.signatoryId) && !hideTools && editMode" 
     color="warn"
     [title]="this.translate.instant('lang.unsign')" style="position: fixed;z-index: 1;bottom: 100px;right: 150px;"
     (click)="unsignMainDocument()">
diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts
index a44e3dfb118..17d254ab886 100755
--- a/src/frontend/app/viewer/document-viewer.component.ts
+++ b/src/frontend/app/viewer/document-viewer.component.ts
@@ -605,6 +605,7 @@ export class DocumentViewerComponent implements OnInit, OnDestroy {
                         this.file.name = `${resId}.${data.originalFormat}`;
                         this.file.format = data.originalFormat;
                         this.file.creatorId = data.originalCreatorId;
+                        this.file.signatoryId = data.signatoryId;
                         this.file.content = `../rest/attachments/${resId}/originalContent?mode=base64`;
                         this.file.contentView = `../rest/attachments/${resId}/content?mode=base64`;
                         this.file.src = this.base64ToArrayBuffer(data.encodedDocument);
@@ -645,6 +646,7 @@ export class DocumentViewerComponent implements OnInit, OnDestroy {
                             this.file.contentMode = 'route';
                             this.file.name = `${resId}.${data.originalFormat}`;
                             this.file.format = data.originalFormat;
+                            this.file.signatoryId = data.signatoryId;
                             this.file.content = `../rest/resources/${resId}/originalContent?mode=base64`;
                             this.file.contentView = `../rest/resources/${resId}/content?mode=base64`;
                             this.file.src = this.base64ToArrayBuffer(data.encodedDocument);
-- 
GitLab