mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Note creation / deletion should respect doc permissions
- Disable add note button on frontend - Explicitly disable add / delete via api
This commit is contained in:
		| @@ -174,7 +174,7 @@ | ||||
|                 <li [ngbNavItem]="DocumentDetailNavIDs.Notes" *ngIf="notesEnabled"> | ||||
|                     <a ngbNavLink i18n>Notes <span *ngIf="document?.notes.length" class="badge text-bg-secondary ms-1">{{document.notes.length}}</span></a> | ||||
|                     <ng-template ngbNavContent> | ||||
|                         <app-document-notes [documentId]="documentId" [notes]="document?.notes" (updated)="notesUpdated($event)"></app-document-notes> | ||||
|                         <app-document-notes [documentId]="documentId" [notes]="document?.notes" [addDisabled]="!userCanEdit" (updated)="notesUpdated($event)"></app-document-notes> | ||||
|                     </ng-template> | ||||
|                 </li> | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|         </div> | ||||
|         <div class="form-group mt-2 d-flex justify-content-end align-items-center"> | ||||
|             <div *ngIf="networkActive" class="spinner-border spinner-border-sm fw-normal me-auto" role="status"></div> | ||||
|             <button type="button" class="btn btn-primary btn-sm" [disabled]="networkActive" (click)="addNote()" i18n>Add note</button> | ||||
|             <button type="button" class="btn btn-primary btn-sm" [disabled]="networkActive || addDisabled" (click)="addNote()" i18n>Add note</button> | ||||
|         </div> | ||||
|     </form> | ||||
|     <hr> | ||||
|   | ||||
| @@ -26,6 +26,9 @@ export class DocumentNotesComponent extends ComponentWithPermissions { | ||||
|   @Input() | ||||
|   notes: PaperlessDocumentNote[] = [] | ||||
|  | ||||
|   @Input() | ||||
|   addDisabled: boolean = false | ||||
|  | ||||
|   @Output() | ||||
|   updated: EventEmitter<PaperlessDocumentNote[]> = new EventEmitter() | ||||
|   users: PaperlessUser[] | ||||
| @@ -61,7 +64,9 @@ export class DocumentNotesComponent extends ComponentWithPermissions { | ||||
|       error: (e) => { | ||||
|         this.networkActive = false | ||||
|         this.toastService.showError( | ||||
|           $localize`Error saving note: ${e.toString()}` | ||||
|           $localize`Error saving note`, | ||||
|           10000, | ||||
|           JSON.stringify(e) | ||||
|         ) | ||||
|       }, | ||||
|     }) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon