mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	disable instead of hide doc edit buttons
This commit is contained in:
		| @@ -5,7 +5,7 @@ | ||||
|       <div class="input-group-text" i18n>of {{previewNumPages}}</div> | ||||
|     </div> | ||||
|  | ||||
|     <button *ifOwner="document" type="button" class="btn btn-sm btn-outline-danger me-2 ms-auto" (click)="delete()"> | ||||
|     <button type="button" class="btn btn-sm btn-outline-danger me-2 ms-auto" (click)="delete()" [disabled]="!userIsOwner"> | ||||
|         <svg class="buttonicon" fill="currentColor"> | ||||
|             <use xlink:href="assets/bootstrap-icons.svg#trash" /> | ||||
|         </svg><span class="d-none d-lg-inline ps-1" i18n>Delete</span> | ||||
| @@ -20,7 +20,7 @@ | ||||
|         </a> | ||||
|  | ||||
|         <div class="btn-group" ngbDropdown role="group" *ngIf="metadata?.has_archive_version"> | ||||
|             <button class="btn btn-sm btn-outline-primary dropdown-toggle-split" ngbDropdownToggle></button> | ||||
|             <button class="btn btn-sm btn-outline-primary dropdown-toggle" ngbDropdownToggle></button> | ||||
|             <div class="dropdown-menu shadow" ngbDropdownMenu> | ||||
|                 <a ngbDropdownItem [href]="downloadOriginalUrl" i18n>Download original</a> | ||||
|             </div> | ||||
| @@ -199,10 +199,10 @@ | ||||
|  | ||||
|             <div [ngbNavOutlet]="nav" class="mt-2"></div> | ||||
|  | ||||
|             <ng-container *ifObjectPermissions="{ object: document, action: PermissionAction.Change }"> | ||||
|                 <button type="button" class="btn btn-outline-secondary" (click)="discard()" i18n [disabled]="networkActive || !(isDirty$ | async)">Discard</button>  | ||||
|                 <button type="button" class="btn btn-outline-primary" (click)="saveEditNext()" *ngIf="hasNext()" i18n [disabled]="networkActive || !(isDirty$ | async) || error">Save & next</button>  | ||||
|                 <button type="submit" class="btn btn-primary" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n [disabled]="networkActive || !(isDirty$ | async) || error">Save</button>  | ||||
|             <ng-container> | ||||
|                 <button type="button" class="btn btn-outline-secondary" (click)="discard()" i18n [disabled]="!userCanEdit || networkActive || !(isDirty$ | async)">Discard</button>  | ||||
|                 <button type="button" class="btn btn-outline-primary" (click)="saveEditNext()" *ngIf="hasNext()" i18n [disabled]="!userCanEdit || networkActive || !(isDirty$ | async) || error">Save & next</button>  | ||||
|                 <button type="submit" class="btn btn-primary" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n [disabled]="!userCanEdit || networkActive || !(isDirty$ | async) || error">Save</button>  | ||||
|             </ng-container> | ||||
|         </form> | ||||
|     </div> | ||||
|   | ||||
| @@ -585,6 +585,13 @@ export class DocumentDetailComponent | ||||
|     ) | ||||
|   } | ||||
|  | ||||
|   get userIsOwner(): boolean { | ||||
|     return ( | ||||
|       !this.document || | ||||
|       this.permissionsService.currentUserOwnsObject(this.document) | ||||
|     ) | ||||
|   } | ||||
|  | ||||
|   get userCanEdit(): boolean { | ||||
|     return ( | ||||
|       !this.document || | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon