Hide order parameter, fix imap port

This commit is contained in:
Michael Shamoon 2022-11-18 17:11:15 -08:00
parent 8c4f486fe9
commit 8bd7c27826
7 changed files with 16 additions and 9 deletions

View File

@ -9,7 +9,7 @@
<div class="col">
<app-input-text i18n-title title="Name" formControlName="name" [error]="error?.name"></app-input-text>
<app-input-text i18n-title title="IMAP Server" formControlName="imap_server" [error]="error?.imap_server"></app-input-text>
<app-input-text i18n-title title="IMAP Port" formControlName="imap_server" [error]="error?.imap_port"></app-input-text>
<app-input-text i18n-title title="IMAP Port" formControlName="imap_port" [error]="error?.imap_port"></app-input-text>
<app-input-select i18n-title title="IMAP Security" [items]="imapSecurityOptions" formControlName="imap_security"></app-input-select>
</div>
<div class="col">

View File

@ -8,7 +8,6 @@
<div class="row">
<div class="col">
<app-input-text i18n-title title="Name" formControlName="name" [error]="error?.name"></app-input-text>
<app-input-text i18n-title title="Order" formControlName="order" [error]="error?.order"></app-input-text>
<app-input-select i18n-title title="Account" [items]="accounts" formControlName="account"></app-input-select>
<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>

View File

@ -64,7 +64,6 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMa
getForm(): FormGroup {
return new FormGroup({
name: new FormControl(null),
order: new FormControl(null),
account: new FormControl(null),
folder: new FormControl('INBOX'),
filter_from: new FormControl(null),

View File

@ -234,7 +234,12 @@
<ng-container *ngIf="mailAccounts && mailRules">
<h4>
<ng-container i18n>Mail accounts</ng-container>
<button type="button" class="btn btn-sm btn-primary ms-4" (click)="editMailAccount()" i18n>Add Account</button>
<button type="button" class="btn btn-sm btn-primary ms-4" (click)="editMailAccount()">
<svg class="sidebaricon me-1" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#plus-circle" />
</svg>
<ng-container i18n>Add Account</ng-container>
</button>
</h4>
<ul class="list-group" formGroupName="mailAccounts">
@ -264,7 +269,12 @@
<h4 class="mt-4">
<ng-container i18n>Mail rules</ng-container>
<button type="button" class="btn btn-sm btn-primary ms-4" (click)="editMailRule()" i18n>Add Rule</button>
<button type="button" class="btn btn-sm btn-primary ms-4" (click)="editMailRule()">
<svg class="sidebaricon me-1" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#plus-circle" />
</svg>
<ng-container i18n>Add Rule</ng-container>
</button>
</h4>
<ul class="list-group" formGroupName="mailRules">

View File

@ -266,7 +266,6 @@ export class SettingsComponent
for (let rule of this.mailRules) {
storeData.mailRules[rule.id.toString()] = {
name: rule.name,
order: rule.order,
account: rule.account,
folder: rule.folder,
filter_from: rule.filter_from,
@ -287,7 +286,6 @@ export class SettingsComponent
rule.id.toString(),
new FormGroup({
name: new FormControl(null),
order: new FormControl(null),
account: new FormControl(null),
folder: new FormControl(null),
filter_from: new FormControl(null),
@ -519,6 +517,7 @@ export class SettingsComponent
this.toastService.showInfo(
$localize`Saved account "${newMailAccount.name}".`
)
this.mailAccountService.clearCache()
this.mailAccountService.listAll().subscribe((r) => {
this.mailAccounts = r.results
this.initialize()
@ -576,6 +575,7 @@ export class SettingsComponent
this.toastService.showInfo(
$localize`Saved rule "${newMailRule.name}".`
)
this.mailRuleService.clearCache()
this.mailRuleService.listAll().subscribe((r) => {
this.mailRules = r.results

View File

@ -28,8 +28,6 @@ export enum MailMetadataCorrespondentOption {
export interface PaperlessMailRule extends ObjectWithId {
name: string
order: number
account: number // PaperlessMailAccount.id
folder: string

View File

@ -748,6 +748,7 @@ class MailRuleSerializer(serializers.ModelSerializer):
assign_correspondent = CorrespondentField(allow_null=True, required=False)
assign_tags = TagsField(many=True, allow_null=True, required=False)
assign_document_type = DocumentTypeField(allow_null=True, required=False)
order = serializers.IntegerField(required=False)
class Meta:
model = MailRule