Merge branch 'dev' into feature-permissions

This commit is contained in:
Michael Shamoon
2023-01-01 17:51:41 -08:00
49 changed files with 2587 additions and 1172 deletions

View File

@@ -12,6 +12,7 @@
<app-input-text i18n-title title="Folder" formControlName="folder" i18n-hint hint="Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server." [error]="error?.folder"></app-input-text>
<app-input-number i18n-title title="Maximum age (days)" formControlName="maximum_age" [showAdd]="false" [error]="error?.maximum_age"></app-input-number>
<app-input-select i18n-title title="Attachment type" [items]="attachmentTypeOptions" formControlName="attachment_type"></app-input-select>
<app-input-select i18n-title title="Consumption scope" [items]="consumptionScopeOptions" formControlName="consumption_scope" i18n-hint hint="See docs for .eml processing requirements"></app-input-select>
</div>
<div class="col">
<p class="small" i18n>Paperless will only process mails that match <em>all</em> of the filters specified below.</p>

View File

@@ -12,6 +12,7 @@ import {
MailMetadataCorrespondentOption,
MailMetadataTitleOption,
PaperlessMailRule,
MailRuleConsumptionScope,
} from 'src/app/data/paperless-mail-rule'
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
@@ -22,11 +23,26 @@ import { UserService } from 'src/app/services/rest/user.service'
const ATTACHMENT_TYPE_OPTIONS = [
{
id: MailFilterAttachmentType.Attachments,
name: $localize`Only process attachments.`,
name: $localize`Only process attachments`,
},
{
id: MailFilterAttachmentType.Everything,
name: $localize`Process all files, including 'inline' attachments.`,
name: $localize`Process all files, including 'inline' attachments`,
},
]
const CONSUMPTION_SCOPE_OPTIONS = [
{
id: MailRuleConsumptionScope.Attachments,
name: $localize`Only process attachments`,
},
{
id: MailRuleConsumptionScope.Email_Only,
name: $localize`Process message as .eml`,
},
{
id: MailRuleConsumptionScope.Everything,
name: $localize`Process message as .eml and attachments separately`,
},
]
@@ -138,6 +154,7 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMa
filter_attachment_filename: new FormControl(null),
maximum_age: new FormControl(null),
attachment_type: new FormControl(MailFilterAttachmentType.Attachments),
consumption_scope: new FormControl(MailRuleConsumptionScope.Attachments),
action: new FormControl(MailAction.MarkRead),
action_parameter: new FormControl(null),
assign_title_from: new FormControl(MailMetadataTitleOption.FromSubject),
@@ -179,4 +196,8 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMa
get metadataCorrespondentOptions() {
return METADATA_CORRESPONDENT_OPTIONS
}
get consumptionScopeOptions() {
return CONSUMPTION_SCOPE_OPTIONS
}
}

View File

@@ -92,7 +92,7 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
if (name) modal.componentInstance.object = { name: name }
else if (this._lastSearchTerm)
modal.componentInstance.object = { name: this._lastSearchTerm }
modal.componentInstance.success.subscribe((newTag) => {
modal.componentInstance.succeeded.subscribe((newTag) => {
this.tagService.listAll().subscribe((tags) => {
this.tags = tags.results
this.value = [...this.value, newTag.id]

View File

@@ -320,7 +320,7 @@ export class DocumentDetailComponent
})
modal.componentInstance.dialogMode = 'create'
if (newName) modal.componentInstance.object = { name: newName }
modal.componentInstance.success
modal.componentInstance.succeeded
.pipe(
switchMap((newDocumentType) => {
return this.documentTypeService
@@ -341,7 +341,7 @@ export class DocumentDetailComponent
})
modal.componentInstance.dialogMode = 'create'
if (newName) modal.componentInstance.object = { name: newName }
modal.componentInstance.success
modal.componentInstance.succeeded
.pipe(
switchMap((newCorrespondent) => {
return this.correspondentService
@@ -364,7 +364,7 @@ export class DocumentDetailComponent
})
modal.componentInstance.dialogMode = 'create'
if (newName) modal.componentInstance.object = { name: newName }
modal.componentInstance.success
modal.componentInstance.succeeded
.pipe(
switchMap((newStoragePath) => {
return this.storagePathService

View File

@@ -32,7 +32,7 @@
[editing]="true"
[multiple]="true"
[applyOnClose]="applyOnClose"
(open)="openTagsDropdown()"
(opened)="openTagsDropdown()"
[(selectionModel)]="tagSelectionModel"
(apply)="setTags($event)">
</app-filterable-dropdown>
@@ -42,7 +42,7 @@
[disabled]="!userCanEditAll"
[editing]="true"
[applyOnClose]="applyOnClose"
(open)="openCorrespondentDropdown()"
(opened)="openCorrespondentDropdown()"
[(selectionModel)]="correspondentSelectionModel"
(apply)="setCorrespondents($event)">
</app-filterable-dropdown>
@@ -52,7 +52,7 @@
[disabled]="!userCanEditAll"
[editing]="true"
[applyOnClose]="applyOnClose"
(open)="openDocumentTypeDropdown()"
(opened)="openDocumentTypeDropdown()"
[(selectionModel)]="documentTypeSelectionModel"
(apply)="setDocumentTypes($event)">
</app-filterable-dropdown>
@@ -62,7 +62,7 @@
[disabled]="!userCanEditAll"
[editing]="true"
[applyOnClose]="applyOnClose"
(open)="openStoragePathDropdown()"
(opened)="openStoragePathDropdown()"
[(selectionModel)]="storagePathsSelectionModel"
(apply)="setStoragePaths($event)">
</app-filterable-dropdown>

View File

@@ -30,27 +30,27 @@
[(selectionModel)]="tagSelectionModel"
(selectionModelChange)="updateRules()"
[multiple]="true"
(open)="onTagsDropdownOpen()"
(opened)="onTagsDropdownOpen()"
[allowSelectNone]="true"></app-filterable-dropdown>
<app-filterable-dropdown class="flex-fill" title="Correspondent" icon="person-fill" i18n-title
filterPlaceholder="Filter correspondents" i18n-filterPlaceholder
[items]="correspondents"
[(selectionModel)]="correspondentSelectionModel"
(selectionModelChange)="updateRules()"
(open)="onCorrespondentDropdownOpen()"
(opened)="onCorrespondentDropdownOpen()"
[allowSelectNone]="true"></app-filterable-dropdown>
<app-filterable-dropdown class="flex-fill" title="Document type" icon="file-earmark-fill" i18n-title
filterPlaceholder="Filter document types" i18n-filterPlaceholder
[items]="documentTypes"
[(selectionModel)]="documentTypeSelectionModel"
(open)="onDocumentTypeDropdownOpen()"
(opened)="onDocumentTypeDropdownOpen()"
(selectionModelChange)="updateRules()"
[allowSelectNone]="true"></app-filterable-dropdown>
<app-filterable-dropdown class="me-2 flex-fill" title="Storage path" icon="folder-fill" i18n-title
filterPlaceholder="Filter storage paths" i18n-filterPlaceholder
[items]="storagePaths"
[(selectionModel)]="storagePathSelectionModel"
(open)="onStoragePathDropdownOpen()"
(opened)="onStoragePathDropdownOpen()"
(selectionModelChange)="updateRules()"
[allowSelectNone]="true"></app-filterable-dropdown>
</div>

View File

@@ -131,7 +131,7 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
backdrop: 'static',
})
activeModal.componentInstance.dialogMode = 'create'
activeModal.componentInstance.success.subscribe({
activeModal.componentInstance.succeeded.subscribe({
next: () => {
this.reloadData()
this.toastService.showInfo(
@@ -154,7 +154,7 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
})
activeModal.componentInstance.object = object
activeModal.componentInstance.dialogMode = 'edit'
activeModal.componentInstance.success.subscribe({
activeModal.componentInstance.succeeded.subscribe({
next: () => {
this.reloadData()
this.toastService.showInfo(

View File

@@ -734,7 +734,7 @@ export class SettingsComponent
})
modal.componentInstance.dialogMode = account ? 'edit' : 'create'
modal.componentInstance.object = account
modal.componentInstance.success
modal.componentInstance.succeeded
.pipe(takeUntil(this.unsubscribeNotifier))
.subscribe({
next: (newMailAccount) => {
@@ -792,7 +792,7 @@ export class SettingsComponent
})
modal.componentInstance.dialogMode = rule ? 'edit' : 'create'
modal.componentInstance.object = rule
modal.componentInstance.success
modal.componentInstance.succeeded
.pipe(takeUntil(this.unsubscribeNotifier))
.subscribe({
next: (newMailRule) => {

View File

@@ -5,6 +5,12 @@ export enum MailFilterAttachmentType {
Everything = 2,
}
export enum MailRuleConsumptionScope {
Attachments = 1,
Email_Only = 2,
Everything = 3,
}
export enum MailAction {
Delete = 1,
Move = 2,