mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Manually dirty check title on doc change
This commit is contained in:
		@@ -172,6 +172,7 @@ export class DocumentDetailComponent
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.route.paramMap
 | 
					    this.route.paramMap
 | 
				
			||||||
      .pipe(
 | 
					      .pipe(
 | 
				
			||||||
 | 
					        takeUntil(this.unsubscribeNotifier),
 | 
				
			||||||
        switchMap((paramMap) => {
 | 
					        switchMap((paramMap) => {
 | 
				
			||||||
          const documentId = +paramMap.get('id')
 | 
					          const documentId = +paramMap.get('id')
 | 
				
			||||||
          this.docChangeNotifier.next(documentId)
 | 
					          this.docChangeNotifier.next(documentId)
 | 
				
			||||||
@@ -206,9 +207,20 @@ export class DocumentDetailComponent
 | 
				
			|||||||
              takeUntil(this.docChangeNotifier),
 | 
					              takeUntil(this.docChangeNotifier),
 | 
				
			||||||
              takeUntil(this.unsubscribeNotifier)
 | 
					              takeUntil(this.unsubscribeNotifier)
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            .subscribe((titleValue) => {
 | 
					            .subscribe({
 | 
				
			||||||
              this.title = titleValue
 | 
					              next: (titleValue) => {
 | 
				
			||||||
              this.documentForm.patchValue({ title: titleValue })
 | 
					                this.title = titleValue
 | 
				
			||||||
 | 
					                this.documentForm.patchValue({ title: titleValue })
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
 | 
					              complete: () => {
 | 
				
			||||||
 | 
					                // doc changed so we manually check dirty in case title was changed
 | 
				
			||||||
 | 
					                if (
 | 
				
			||||||
 | 
					                  this.store.getValue().title !==
 | 
				
			||||||
 | 
					                  this.documentForm.get('title').value
 | 
				
			||||||
 | 
					                ) {
 | 
				
			||||||
 | 
					                  this.openDocumentService.setDirty(doc.id, true)
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          this.ogDate = new Date(normalizeDateStr(doc.created.toString()))
 | 
					          this.ogDate = new Date(normalizeDateStr(doc.created.toString()))
 | 
				
			||||||
@@ -238,7 +250,6 @@ export class DocumentDetailComponent
 | 
				
			|||||||
          return this.isDirty$.pipe(map((dirty) => ({ doc, dirty })))
 | 
					          return this.isDirty$.pipe(map((dirty) => ({ doc, dirty })))
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
      .pipe(takeUntil(this.unsubscribeNotifier))
 | 
					 | 
				
			||||||
      .subscribe({
 | 
					      .subscribe({
 | 
				
			||||||
        next: ({ doc, dirty }) => {
 | 
					        next: ({ doc, dirty }) => {
 | 
				
			||||||
          this.openDocumentService.setDirty(doc.id, dirty)
 | 
					          this.openDocumentService.setDirty(doc.id, dirty)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user