A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: disable toggle for share link creation without archive version, fix auto-copy in Safari (#4885)
shamoon5942cd6cd240
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlfindex 9bef07c8e..d9c8836cd 100644--- a/src-ui/messages.xlf+++ b/src-ui/messages.xlf@@ -247,18 +247,18 @@<source>Document <x id="PH" equiv-text="status.filename"/> was added to Paperless-ngx.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">83</context>+ <context context-type="linenumber">81</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">92</context>+ <context context-type="linenumber">90</context></context-group></trans-unit><trans-unit id="1931214133925051574" datatype="html"><source>Open document</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">85</context>+ <context context-type="linenumber">83</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html</context>@@ -269,28 +269,28 @@<source>Could not add <x id="PH" equiv-text="status.filename"/>: <x id="PH_1" equiv-text="status.message"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">107</context>+ <context context-type="linenumber">105</context></context-group></trans-unit><trans-unit id="1218124467712564468" datatype="html"><source>Document <x id="PH" equiv-text="status.filename"/> is being processed by Paperless-ngx.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">122</context>+ <context context-type="linenumber">120</context></context-group></trans-unit><trans-unit id="2501522447884928778" datatype="html"><source>Prev</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">128</context>+ <context context-type="linenumber">126</context></context-group></trans-unit><trans-unit id="3885497195825665706" datatype="html"><source>Next</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">129</context>+ <context context-type="linenumber">127</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.html</context>@@ -301,98 +301,98 @@<source>End</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">130</context>+ <context context-type="linenumber">128</context></context-group></trans-unit><trans-unit id="3909462337752654810" datatype="html"><source>The dashboard can be used to show saved views, such as an 'Inbox'. Those settings are found under Settings > Saved Views once you have created some.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">136</context>+ <context context-type="linenumber">134</context></context-group></trans-unit><trans-unit id="9075755296812854717" datatype="html"><source>Drag-and-drop documents here to start uploading or place them in the consume folder. You can also drag-and-drop documents anywhere on all other pages of the web app. Once you do, Paperless-ngx will start training its machine learning algorithms.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">143</context>+ <context context-type="linenumber">141</context></context-group></trans-unit><trans-unit id="7495498057594070122" datatype="html"><source>The documents list shows all of your documents and allows for filtering as well as bulk-editing. There are three different view styles: list, small cards and large cards. A list of documents currently opened for editing is shown in the sidebar.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">148</context>+ <context context-type="linenumber">146</context></context-group></trans-unit><trans-unit id="1334220418719920556" datatype="html"><source>The filtering tools allow you to quickly find documents using various searches, dates, tags, etc.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">155</context>+ <context context-type="linenumber">153</context></context-group></trans-unit><trans-unit id="5427326625898532358" datatype="html"><source>Any combination of filters can be saved as a 'view' which can then be displayed on the dashboard and / or sidebar.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">161</context>+ <context context-type="linenumber">159</context></context-group></trans-unit><trans-unit id="2804886236408698479" datatype="html"><source>Tags, correspondents, document types and storage paths can all be managed using these pages. They can also be created from the document edit view.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">166</context>+ <context context-type="linenumber">164</context></context-group></trans-unit><trans-unit id="7851939076947092983" datatype="html"><source>Manage e-mail accounts and rules for automatically importing documents.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">174</context>+ <context context-type="linenumber">172</context></context-group></trans-unit><trans-unit id="1347174817382304718" datatype="html"><source>Consumption templates give you finer control over the document ingestion process.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">182</context>+ <context context-type="linenumber">180</context></context-group></trans-unit><trans-unit id="4680387114119209483" datatype="html"><source>File Tasks shows you documents that have been consumed, are waiting to be, or may have failed during the process.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">190</context>+ <context context-type="linenumber">188</context></context-group></trans-unit><trans-unit id="1453710303796913192" datatype="html"><source>Check out the settings for various tweaks to the web app and toggle settings for saved views.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">198</context>+ <context context-type="linenumber">196</context></context-group></trans-unit><trans-unit id="7172877665285340082" datatype="html"><source>Thank you! 🙏</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">206</context>+ <context context-type="linenumber">204</context></context-group></trans-unit><trans-unit id="7354947513482088740" datatype="html"><source>There are <em>tons</em> more features and info we didn't cover here, but this should get you started. Check out the documentation or visit the project on GitHub to learn more or to report issues.</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">208</context>+ <context context-type="linenumber">206</context></context-group></trans-unit><trans-unit id="4270528545616947218" datatype="html"><source>Lastly, on behalf of every contributor to this community-supported project, thank you for using Paperless-ngx!</source><context-group purpose="location"><context context-type="sourcefile">src/app/app.component.ts</context>- <context context-type="linenumber">210</context>+ <context context-type="linenumber">208</context></context-group></trans-unit><trans-unit id="4804785061014590286" datatype="html">@@ -3884,7 +3884,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts</context>- <context context-type="linenumber">93</context>+ <context context-type="linenumber">97</context></context-group></trans-unit><trans-unit id="8542568275115626925" datatype="html">@@ -3912,28 +3912,28 @@<source>Error retrieving links</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts</context>- <context context-type="linenumber">74</context>+ <context context-type="linenumber">78</context></context-group></trans-unit><trans-unit id="3242255798983858463" datatype="html"><source><x id="PH" equiv-text="days"/> days</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts</context>- <context context-type="linenumber">93</context>+ <context context-type="linenumber">97</context></context-group></trans-unit><trans-unit id="2897042887615940599" datatype="html"><source>Error deleting link</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts</context>- <context context-type="linenumber">120</context>+ <context context-type="linenumber">126</context></context-group></trans-unit><trans-unit id="8400747326190565173" datatype="html"><source>Error creating link</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts</context>- <context context-type="linenumber">148</context>+ <context context-type="linenumber">156</context></context-group></trans-unit><trans-unit id="5611592591303869712" datatype="html">diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.html b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.htmlindex 2d708981f..c88933686 100644--- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.html+++ b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.html@@ -38,7 +38,7 @@<li class="list-group-item pt-3 pb-2"><div class="input-group input-group-sm w-100"><div class="form-check form-switch ms-auto">- <input class="form-check-input" type="checkbox" role="switch" id="versionSwitch" [(ngModel)]="archiveVersion">+ <input class="form-check-input" type="checkbox" role="switch" id="versionSwitch" [disabled]="!hasArchiveVersion" [(ngModel)]="useArchiveVersion"><label class="form-check-label small" for="versionSwitch" i18n>Share archive version</label></div></div>diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.tsindex 27955a8a5..0b7284383 100644--- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts+++ b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts@@ -19,6 +19,7 @@ import { ToastService } from 'src/app/services/toast.service'import { environment } from 'src/environments/environment'import { ShareLinksDropdownComponent } from './share-links-dropdown.component'import { Clipboard } from '@angular/cdk/clipboard'+import { By } from '@angular/platform-browser'describe('ShareLinksDropdownComponent', () => {let component: ShareLinksDropdownComponent@@ -88,7 +89,7 @@ describe('ShareLinksDropdownComponent', () => {.mockReturnValueOnce(throwError(() => new Error('Unable to get links')))component.documentId = 99- component.refresh()+ component.ngOnInit()fixture.detectChanges()expect(toastSpy).toHaveBeenCalled()})@@ -97,12 +98,13 @@ describe('ShareLinksDropdownComponent', () => {const createSpy = jest.spyOn(shareLinkService, 'createLinkForDocument')component.documentId = 99component.expirationDays = 7- component.archiveVersion = false+ component.useArchiveVersion = falseconst expiration = new Date()expiration.setDate(expiration.getDate() + 7)const copySpy = jest.spyOn(clipboard, 'copy')+ copySpy.mockReturnValue(true)const refreshSpy = jest.spyOn(component, 'refresh')component.createLink()@@ -117,8 +119,10 @@ describe('ShareLinksDropdownComponent', () => {fixture.detectChanges()tick(3000)- expect(copySpy).toHaveBeenCalled()expect(refreshSpy).toHaveBeenCalled()+ expect(copySpy).toHaveBeenCalled()+ expect(component.copied).toEqual(1)+ tick(100) // copy timeout}))it('should show error on link creation if needed', () => {@@ -212,4 +216,16 @@ describe('ShareLinksDropdownComponent', () => {'http://example.domainwithapiinit.com:1234/subpath/share/123abc123')})++ it('should disable archive switch & option if no archive available', () => {+ component.hasArchiveVersion = false+ component.ngOnInit()+ fixture.detectChanges()+ expect(component.useArchiveVersion).toBeFalsy()+ expect(+ fixture.debugElement.query(By.css("input[type='checkbox']")).attributes[+ 'ng-reflect-is-disabled'+ ]+ ).toBeTruthy()+ })})diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.tsindex fa2df3a54..cce951ba2 100644--- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts+++ b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts@@ -38,6 +38,9 @@ export class ShareLinksDropdownComponent implements OnInit {@Input()disabled: boolean = false+ @Input()+ hasArchiveVersion: boolean = true+shareLinks: PaperlessShareLink[]loading: boolean = false@@ -46,7 +49,7 @@ export class ShareLinksDropdownComponent implements OnInit {expirationDays: number = 7- archiveVersion: boolean = true+ useArchiveVersion: boolean = trueconstructor(private shareLinkService: ShareLinkService,@@ -56,6 +59,7 @@ export class ShareLinksDropdownComponent implements OnInit {ngOnInit(): void {if (this._documentId !== undefined) this.refresh()+ this.useArchiveVersion = this.hasArchiveVersion}refresh() {@@ -94,11 +98,13 @@ export class ShareLinksDropdownComponent implements OnInit {}copy(link: PaperlessShareLink) {- this.clipboard.copy(this.getShareUrl(link))- this.copied = link.id- setTimeout(() => {- this.copied = null- }, 3000)+ const success = this.clipboard.copy(this.getShareUrl(link))+ if (success) {+ this.copied = link.id+ setTimeout(() => {+ this.copied = null+ }, 3000)+ }}canShare(link: PaperlessShareLink): boolean {@@ -132,7 +138,7 @@ export class ShareLinksDropdownComponent implements OnInit {this.shareLinkService.createLinkForDocument(this._documentId,- this.archiveVersion+ this.useArchiveVersion? PaperlessFileVersion.Archive: PaperlessFileVersion.Original,expiration@@ -140,7 +146,9 @@ export class ShareLinksDropdownComponent implements OnInit {.subscribe({next: (result) => {this.loading = false- this.copy(result)+ setTimeout(() => {+ this.copy(result)+ }, 10)this.refresh()},error: (e) => {diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.htmlindex ea14b750d..aa2f91a35 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.html+++ b/src-ui/src/app/components/document-detail/document-detail.component.html@@ -69,7 +69,7 @@(added)="addField($event)"></pngx-custom-fields-dropdown>- <pngx-share-links-dropdown [documentId]="documentId" [disabled]="!userIsOwner" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.ShareLink }"></pngx-share-links-dropdown>+ <pngx-share-links-dropdown [documentId]="documentId" [hasArchiveVersion]="!!document?.archived_file_name" [disabled]="!userIsOwner" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.ShareLink }"></pngx-share-links-dropdown></pngx-page-header><div class="row">diff --git a/src-ui/src/app/data/paperless-document.ts b/src-ui/src/app/data/paperless-document.tsindex b00c478fc..8071e2b45 100644--- a/src-ui/src/app/data/paperless-document.ts+++ b/src-ui/src/app/data/paperless-document.ts@@ -50,6 +50,8 @@ export interface PaperlessDocument extends ObjectWithPermissions {original_file_name?: string+ archived_file_name?: string+download_url?: stringthumbnail_url?: string