A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Enhancement: disable-able mail rules, add toggle to overview (#7810)
shamoon991c9b0ca4ad
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlfindex c64cef921..e0d30bdc2 100644--- a/src-ui/messages.xlf+++ b/src-ui/messages.xlf@@ -560,7 +560,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">72</context>+ <context context-type="linenumber">75</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html</context>@@ -726,7 +726,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">137</context>+ <context context-type="linenumber">146</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1100,11 +1100,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">99</context>+ <context context-type="linenumber">108</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">111</context>+ <context context-type="linenumber">120</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1406,7 +1406,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">81</context>+ <context context-type="linenumber">82</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1505,11 +1505,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">100</context>+ <context context-type="linenumber">109</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">114</context>+ <context context-type="linenumber">123</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1668,7 +1668,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">71</context>+ <context context-type="linenumber">74</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html</context>@@ -2227,7 +2227,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">179</context>+ <context context-type="linenumber">194</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -2430,11 +2430,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">98</context>+ <context context-type="linenumber">107</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">108</context>+ <context context-type="linenumber">117</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -2578,7 +2578,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">181</context>+ <context context-type="linenumber">196</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -3666,166 +3666,185 @@<context context-type="linenumber">88</context></context-group></trans-unit>- <trans-unit id="5163375362523428079" datatype="html">- <source>Rule order</source>+ <trans-unit id="4086606389696938932" datatype="html">+ <source>Account</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context><context context-type="linenumber">16</context></context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">80</context>+ </context-group></trans-unit>- <trans-unit id="4086606389696938932" datatype="html">- <source>Account</source>+ <trans-unit id="220550782947016929" datatype="html">+ <source>Order</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context><context context-type="linenumber">19</context></context-group>+ </trans-unit>+ <trans-unit id="4816216590591222133" datatype="html">+ <source>Enabled</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>+ <context context-type="linenumber">22</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>+ <context context-type="linenumber">19</context>+ </context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">80</context>+ <context context-type="linenumber">96</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>+ <context context-type="linenumber">30</context></context-group></trans-unit><trans-unit id="4348351765075925931" datatype="html"><source>Paperless will only process mails that match <x id="START_EMPHASISED_TEXT" ctype="x-em" equiv-text="<em>"/>all<x id="CLOSE_EMPHASISED_TEXT" ctype="x-em" equiv-text="</em>"/> of the criteria specified below.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">24</context>+ <context context-type="linenumber">27</context></context-group></trans-unit><trans-unit id="7046259383943324039" datatype="html"><source>Folder</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">26</context>+ <context context-type="linenumber">29</context></context-group></trans-unit><trans-unit id="1391527525114848695" datatype="html"><source>Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">26</context>+ <context context-type="linenumber">29</context></context-group></trans-unit><trans-unit id="101686279614365671" datatype="html"><source>Maximum age (days)</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">27</context>+ <context context-type="linenumber">30</context></context-group></trans-unit><trans-unit id="6925928412364847639" datatype="html"><source>Filter from</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">30</context>+ <context context-type="linenumber">33</context></context-group></trans-unit><trans-unit id="8977094263269822022" datatype="html"><source>Filter to</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">31</context>+ <context context-type="linenumber">34</context></context-group></trans-unit><trans-unit id="8497813481090627874" datatype="html"><source>Filter subject</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">32</context>+ <context context-type="linenumber">35</context></context-group></trans-unit><trans-unit id="7314357616097563149" datatype="html"><source>Filter body</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">33</context>+ <context context-type="linenumber">36</context></context-group></trans-unit><trans-unit id="559099472394646919" datatype="html"><source>Consumption scope</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">39</context>+ <context context-type="linenumber">42</context></context-group></trans-unit><trans-unit id="56643687972548912" datatype="html"><source>See docs for .eml processing requirements</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">39</context>+ <context context-type="linenumber">42</context></context-group></trans-unit><trans-unit id="7093509971705471817" datatype="html"><source>Attachment type</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">40</context>+ <context context-type="linenumber">43</context></context-group></trans-unit><trans-unit id="2873939123535615966" datatype="html"><source>Include only files matching</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">43</context>+ <context context-type="linenumber">46</context></context-group></trans-unit><trans-unit id="7233407036155150477" datatype="html"><source>Optional. Wildcards e.g. *.pdf or *invoice* allowed. Can be comma-separated list. Case insensitive.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">43</context>+ <context context-type="linenumber">46</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">44</context>+ <context context-type="linenumber">47</context></context-group></trans-unit><trans-unit id="1546332577833742677" datatype="html"><source>Exclude files matching</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">44</context>+ <context context-type="linenumber">47</context></context-group></trans-unit><trans-unit id="9216117865911519658" datatype="html"><source>Action</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">50</context>+ <context context-type="linenumber">53</context></context-group></trans-unit><trans-unit id="7841986067387421166" datatype="html"><source>Only performed if the mail is processed.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">50</context>+ <context context-type="linenumber">53</context></context-group></trans-unit><trans-unit id="1261794314435932203" datatype="html"><source>Action parameter</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">52</context>+ <context context-type="linenumber">55</context></context-group></trans-unit><trans-unit id="6093797930511670257" datatype="html"><source>Assign title from</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">54</context>+ <context context-type="linenumber">57</context></context-group></trans-unit><trans-unit id="5232720756589450549" datatype="html"><source>Assign owner from rule</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">55</context>+ <context context-type="linenumber">58</context></context-group></trans-unit><trans-unit id="6695990587380209737" datatype="html"><source>Assign document type</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">59</context>+ <context context-type="linenumber">62</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>@@ -3836,14 +3855,14 @@<source>Assign correspondent from</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">60</context>+ <context context-type="linenumber">63</context></context-group></trans-unit><trans-unit id="4875491778188965469" datatype="html"><source>Assign correspondent</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">62</context>+ <context context-type="linenumber">65</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>@@ -3854,7 +3873,7 @@<source>Error</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>- <context context-type="linenumber">69</context>+ <context context-type="linenumber">72</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>@@ -4166,17 +4185,6 @@<context context-type="linenumber">18</context></context-group></trans-unit>- <trans-unit id="4816216590591222133" datatype="html">- <source>Enabled</source>- <context-group purpose="location">- <context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>- <context context-type="linenumber">19</context>- </context-group>- <context-group purpose="location">- <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>- <context context-type="linenumber">30</context>- </context-group>- </trans-unit><trans-unit id="1586840222182376783" datatype="html"><source>Triggers</source><context-group purpose="location">@@ -5043,11 +5051,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">101</context>+ <context context-type="linenumber">110</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">119</context>+ <context context-type="linenumber">128</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>@@ -5358,6 +5366,10 @@<context context-type="sourcefile">src/app/components/common/toasts/toasts.component.html</context><context context-type="linenumber">26</context></context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">81</context>+ </context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context><context context-type="linenumber">19</context>@@ -7513,11 +7525,22 @@<context context-type="linenumber">79</context></context-group></trans-unit>+ <trans-unit id="5769292297914455214" datatype="html">+ <source>Disabled</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">96</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>+ <context context-type="linenumber">30</context>+ </context-group>+ </trans-unit><trans-unit id="6751234988479444294" datatype="html"><source>No mail rules defined.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">128</context>+ <context context-type="linenumber">137</context></context-group></trans-unit><trans-unit id="3178554336792037159" datatype="html">@@ -7590,46 +7613,67 @@<context context-type="linenumber">162</context></context-group></trans-unit>+ <trans-unit id="3574401690710711341" datatype="html">+ <source>Rule "<x id="PH" equiv-text="rule.name"/>" enabled.</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>+ <context context-type="linenumber">178</context>+ </context-group>+ </trans-unit>+ <trans-unit id="7171685227222299542" datatype="html">+ <source>Rule "<x id="PH" equiv-text="rule.name"/>" disabled.</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>+ <context context-type="linenumber">179</context>+ </context-group>+ </trans-unit>+ <trans-unit id="684458488797860482" datatype="html">+ <source>Error toggling rule.</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>+ <context context-type="linenumber">183</context>+ </context-group>+ </trans-unit><trans-unit id="3896080636020672118" datatype="html"><source>Confirm delete mail rule</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">177</context>+ <context context-type="linenumber">192</context></context-group></trans-unit><trans-unit id="2250372580580310337" datatype="html"><source>This operation will permanently delete this mail rule.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">178</context>+ <context context-type="linenumber">193</context></context-group></trans-unit><trans-unit id="9077981247971516916" datatype="html"><source>Deleted mail rule</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">187</context>+ <context context-type="linenumber">202</context></context-group></trans-unit><trans-unit id="2033194641751367552" datatype="html"><source>Error deleting mail rule.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">196</context>+ <context context-type="linenumber">211</context></context-group></trans-unit><trans-unit id="3061362835271417984" datatype="html"><source>Permissions updated</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">218</context>+ <context context-type="linenumber">233</context></context-group></trans-unit><trans-unit id="4639647950943944112" datatype="html"><source>Error updating permissions</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">223</context>+ <context context-type="linenumber">238</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -7879,13 +7923,6 @@<context context-type="linenumber">9</context></context-group></trans-unit>- <trans-unit id="5769292297914455214" datatype="html">- <source>Disabled</source>- <context-group purpose="location">- <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>- <context context-type="linenumber">30</context>- </context-group>- </trans-unit><trans-unit id="1624023882313260402" datatype="html"><source>No workflows defined.</source><context-group purpose="location">@@ -8779,21 +8816,21 @@<source>Successfully completed one-time migratration of settings to the database!</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/settings.service.ts</context>- <context context-type="linenumber">573</context>+ <context context-type="linenumber">574</context></context-group></trans-unit><trans-unit id="5558341108007064934" datatype="html"><source>Unable to migrate settings to the database, please try saving manually.</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/settings.service.ts</context>- <context context-type="linenumber">574</context>+ <context context-type="linenumber">575</context></context-group></trans-unit><trans-unit id="1168781785897678748" datatype="html"><source>You can restart the tour from the settings page.</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/settings.service.ts</context>- <context context-type="linenumber">644</context>+ <context context-type="linenumber">645</context></context-group></trans-unit><trans-unit id="3852289441366561594" datatype="html">diff --git a/src-ui/src/app/components/app-frame/global-search/global-search.component.scss b/src-ui/src/app/components/app-frame/global-search/global-search.component.scssindex 1b4f6cd19..bbb7840c5 100644--- a/src-ui/src/app/components/app-frame/global-search/global-search.component.scss+++ b/src-ui/src/app/components/app-frame/global-search/global-search.component.scss@@ -65,10 +65,6 @@ form {--pngx-focus-alpha: 0;}-.cursor-pointer {- cursor: pointer;-}-.mh-75 {max-height: 75vh;}diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.htmlindex a7c0617b0..a9ad3040b 100644--- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html+++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html@@ -12,12 +12,15 @@<div class="col-md-4"><pngx-input-text [horizontal]="true" i18n-title title="Name" formControlName="name" [error]="error?.name" autocomplete="off"></pngx-input-text></div>- <div class="col-md-4">- <pngx-input-number [horizontal]="true" i18n-title title="Rule order" formControlName="order" [showAdd]="false" [error]="error?.order"></pngx-input-number>- </div>- <div class="col-md-4">+ <div class="col-md-3"><pngx-input-select [horizontal]="true" i18n-title title="Account" [items]="accounts" formControlName="account"></pngx-input-select></div>+ <div class="col-md-3">+ <pngx-input-number [horizontal]="true" i18n-title title="Order" formControlName="order" [showAdd]="false" [error]="error?.order"></pngx-input-number>+ </div>+ <div class="col-md-2 pt-2">+ <pngx-input-switch [horizontal]="true" i18n-title title="Enabled" formControlName="enabled"></pngx-input-switch>+ </div></div><hr class="mt-0"/><div class="row">diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.tsindex 53546a55d..19655ae4d 100644--- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts+++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts@@ -24,6 +24,7 @@ import { TextComponent } from '../../input/text/text.component'import { EditDialogMode } from '../edit-dialog.component'import { MailRuleEditDialogComponent } from './mail-rule-edit-dialog.component'import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'+import { SwitchComponent } from '../../input/switch/switch.component'describe('MailRuleEditDialogComponent', () => {let component: MailRuleEditDialogComponent@@ -43,6 +44,7 @@ describe('MailRuleEditDialogComponent', () => {TagsComponent,SafeHtmlPipe,CheckComponent,+ SwitchComponent,],imports: [FormsModule, ReactiveFormsModule, NgSelectModule, NgbModule],providers: [diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.tsindex 51793e78a..633c49967 100644--- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts+++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts@@ -153,6 +153,7 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<MailRule> {return new FormGroup({name: new FormControl(null),account: new FormControl(null),+ enabled: new FormControl(true),folder: new FormControl('INBOX'),filter_from: new FormControl(null),filter_to: new FormControl(null),diff --git a/src-ui/src/app/components/document-list/document-list.component.scss b/src-ui/src/app/components/document-list/document-list.component.scssindex fb7db4b01..0e10b83da 100644--- a/src-ui/src/app/components/document-list/document-list.component.scss+++ b/src-ui/src/app/components/document-list/document-list.component.scss@@ -6,10 +6,6 @@ tr {user-select: none;}-.cursor-pointer {- cursor: pointer;-}-.table-row-selected {background-color: var(--pngx-primary-faded);}diff --git a/src-ui/src/app/components/manage/mail/mail.component.html b/src-ui/src/app/components/manage/mail/mail.component.htmlindex add5614c4..296d80055 100644--- a/src-ui/src/app/components/manage/mail/mail.component.html+++ b/src-ui/src/app/components/manage/mail/mail.component.html@@ -78,6 +78,7 @@<div class="col" i18n>Name</div><div class="col d-none d-sm-block" i18n>Sort Order</div><div class="col" i18n>Account</div>+ <div class="col d-none d-sm-block" i18n>Status</div><div class="col" i18n>Actions</div></div></li>@@ -86,8 +87,16 @@<li class="list-group-item"><div class="row"><div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editMailRule(rule)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailRule)">{{rule.name}}</button></div>- <div class="col d-flex align-items-center d-none d-sm-block">{{rule.order}}</div>+ <div class="col d-flex align-items-center d-none d-sm-flex">{{rule.order}}</div><div class="col d-flex align-items-center">{{(mailAccountService.getCached(rule.account) | async)?.name}}</div>+ <div class="col d-flex align-items-center d-none d-sm-flex">+ <div class="form-check form-switch mb-0">+ <input #inputField type="checkbox" class="form-check-input cursor-pointer" [id]="rule.id+'_enable'" [(ngModel)]="rule.enabled" (change)="onMailRuleEnableToggled(rule)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }">+ <label class="form-check-label cursor-pointer" [for]="rule.id+'_enable'">+ <code> @if(rule.enabled) { <ng-container i18n>Enabled</ng-container> } @else { <span i18n class="text-muted">Disabled</span> }</code>+ </label>+ </div>+ </div><div class="col"><div class="btn-group d-block d-sm-none"><div ngbDropdown container="body" class="d-inline-block">diff --git a/src-ui/src/app/components/manage/mail/mail.component.spec.ts b/src-ui/src/app/components/manage/mail/mail.component.spec.tsindex 4a134b880..14cd10944 100644--- a/src-ui/src/app/components/manage/mail/mail.component.spec.ts+++ b/src-ui/src/app/components/manage/mail/mail.component.spec.ts@@ -43,14 +43,15 @@ import { EditDialogMode } from '../../common/edit-dialog/edit-dialog.component'import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'import { SwitchComponent } from '../../common/input/switch/switch.component'import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'+import { By } from '@angular/platform-browser'const mailAccounts = [{ id: 1, name: 'account1' },{ id: 2, name: 'account2' },]const mailRules = [- { id: 1, name: 'rule1', owner: 1, account: 1 },- { id: 2, name: 'rule2', owner: 2, account: 2 },+ { id: 1, name: 'rule1', owner: 1, account: 1, enabled: true },+ { id: 2, name: 'rule2', owner: 2, account: 2, enabled: true },]describe('MailComponent', () => {@@ -321,4 +322,30 @@ describe('MailComponent', () => {dialog.confirmClicked.emit({ permissions: perms, merge: true })expect(accountPatchSpy).toHaveBeenCalled()})++ it('should update mail rule when enable is toggled', () => {+ completeSetup()+ const patchSpy = jest.spyOn(mailRuleService, 'patch')+ const toggleInput = fixture.debugElement.query(+ By.css('input[type="checkbox"]')+ )+ const toastErrorSpy = jest.spyOn(toastService, 'showError')+ const toastInfoSpy = jest.spyOn(toastService, 'showInfo')+ // fail first+ patchSpy.mockReturnValueOnce(+ throwError(() => new Error('Error getting config'))+ )+ toggleInput.nativeElement.click()+ expect(patchSpy).toHaveBeenCalled()+ expect(toastErrorSpy).toHaveBeenCalled()+ // succeed second+ patchSpy.mockReturnValueOnce(of(mailRules[0] as MailRule))+ toggleInput.nativeElement.click()+ patchSpy.mockReturnValueOnce(+ of({ ...mailRules[0], enabled: false } as MailRule)+ )+ toggleInput.nativeElement.click()+ expect(patchSpy).toHaveBeenCalled()+ expect(toastInfoSpy).toHaveBeenCalled()+ })})diff --git a/src-ui/src/app/components/manage/mail/mail.component.ts b/src-ui/src/app/components/manage/mail/mail.component.tsindex 5d00b6c13..288e8e121 100644--- a/src-ui/src/app/components/manage/mail/mail.component.ts+++ b/src-ui/src/app/components/manage/mail/mail.component.ts@@ -170,6 +170,21 @@ export class MailComponentthis.editMailRule(clone, true)}+ onMailRuleEnableToggled(rule: MailRule) {+ this.mailRuleService.patch(rule).subscribe({+ next: () => {+ this.toastService.showInfo(+ rule.enabled+ ? $localize`Rule "${rule.name}" enabled.`+ : $localize`Rule "${rule.name}" disabled.`+ )+ },+ error: (e) => {+ this.toastService.showError($localize`Error toggling rule.`, e)+ },+ })+ }+deleteMailRule(rule: MailRule) {const modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static',diff --git a/src-ui/src/app/data/mail-rule.ts b/src-ui/src/app/data/mail-rule.tsindex 2611fa3ba..7888b19e6 100644--- a/src-ui/src/app/data/mail-rule.ts+++ b/src-ui/src/app/data/mail-rule.ts@@ -39,6 +39,8 @@ export interface MailRule extends ObjectWithPermissions {order: number+ enabled: boolean+folder: stringfilter_from: stringdiff --git a/src-ui/src/app/services/rest/mail-rule.service.spec.ts b/src-ui/src/app/services/rest/mail-rule.service.spec.tsindex ea84e8b86..87e21172c 100644--- a/src-ui/src/app/services/rest/mail-rule.service.spec.ts+++ b/src-ui/src/app/services/rest/mail-rule.service.spec.ts@@ -18,6 +18,7 @@ const mail_rules = [id: 1,account: 1,order: 1,+ enabled: true,folder: 'INBOX',filter_from: null,filter_to: null,@@ -36,6 +37,7 @@ const mail_rules = [id: 2,account: 1,order: 1,+ enabled: true,folder: 'INBOX',filter_from: null,filter_to: null,@@ -54,6 +56,7 @@ const mail_rules = [id: 3,account: 1,order: 1,+ enabled: true,folder: 'INBOX',filter_from: null,filter_to: null,diff --git a/src-ui/src/styles.scss b/src-ui/src/styles.scssindex c83ebd493..ef856fbc7 100644--- a/src-ui/src/styles.scss+++ b/src-ui/src/styles.scss@@ -369,6 +369,10 @@ textarea,cursor: not-allowed;}+.cursor-pointer {+ cursor: pointer;+}+ul.pagination {margin-bottom: 0;}diff --git a/src/documents/tests/test_migration_workflows.py b/src/documents/tests/test_migration_workflows.pyindex 403067ca6..81bb577b2 100644--- a/src/documents/tests/test_migration_workflows.py+++ b/src/documents/tests/test_migration_workflows.py@@ -8,7 +8,7 @@ class TestMigrateWorkflow(TestMigrations):dependencies = (("paperless_mail",- "0025_alter_mailaccount_owner_alter_mailrule_owner_and_more",+ "0026_mailrule_enabled",),)diff --git a/src/paperless_mail/admin.py b/src/paperless_mail/admin.pyindex adec5e17c..2ff313584 100644--- a/src/paperless_mail/admin.py+++ b/src/paperless_mail/admin.py@@ -53,7 +53,7 @@ class MailRuleAdmin(GuardedModelAdmin):}fieldsets = (- (None, {"fields": ("name", "order", "account", "folder")}),+ (None, {"fields": ("name", "order", "account", "enabled", "folder")}),(_("Filter"),{diff --git a/src/paperless_mail/mail.py b/src/paperless_mail/mail.pyindex b52a2ebe4..84f97b742 100644--- a/src/paperless_mail/mail.py+++ b/src/paperless_mail/mail.py@@ -536,6 +536,9 @@ class MailAccountHandler(LoggingMixin):)for rule in account.rules.order_by("order"):+ if not rule.enabled:+ self.log.debug(f"Rule {rule}: Skipping disabled rule")+ continuetry:total_processed_files += self._handle_mail_rule(M,diff --git a/src/paperless_mail/migrations/0026_mailrule_enabled.py b/src/paperless_mail/migrations/0026_mailrule_enabled.pynew file mode 100644index 000000000..c10ee698c--- /dev/null+++ b/src/paperless_mail/migrations/0026_mailrule_enabled.py@@ -0,0 +1,21 @@+# Generated by Django 5.1.1 on 2024-09-30 15:17++from django.db import migrations+from django.db import models+++class Migration(migrations.Migration):+ dependencies = [+ (+ "paperless_mail",+ "0025_alter_mailaccount_owner_alter_mailrule_owner_and_more",+ ),+ ]++ operations = [+ migrations.AddField(+ model_name="mailrule",+ name="enabled",+ field=models.BooleanField(default=True, verbose_name="enabled"),+ ),+ ]diff --git a/src/paperless_mail/models.py b/src/paperless_mail/models.pyindex c53b16f1f..c23ea48c7 100644--- a/src/paperless_mail/models.py+++ b/src/paperless_mail/models.py@@ -115,6 +115,8 @@ class MailRule(document_models.ModelWithOwner):verbose_name=_("account"),)+ enabled = models.BooleanField(_("enabled"), default=True)+folder = models.CharField(_("folder"),default="INBOX",diff --git a/src/paperless_mail/serialisers.py b/src/paperless_mail/serialisers.pyindex 38ee9661e..9237b47de 100644--- a/src/paperless_mail/serialisers.py+++ b/src/paperless_mail/serialisers.py@@ -74,6 +74,7 @@ class MailRuleSerializer(OwnedObjectSerializer):"id","name","account",+ "enabled","folder","filter_from","filter_to",diff --git a/src/paperless_mail/tests/test_mail.py b/src/paperless_mail/tests/test_mail.pyindex c12b54ffe..9078335a6 100644--- a/src/paperless_mail/tests/test_mail.py+++ b/src/paperless_mail/tests/test_mail.py@@ -1388,6 +1388,41 @@ class TestMail(self.assertEqual(len(self.mailMocker.bogus_mailbox.fetch("UNSEEN", False)), 0)self.assertEqual(len(self.mailMocker.bogus_mailbox.messages), 3)+ def test_disabled_rule(self):+ """+ GIVEN:+ - Mail rule is disabled+ WHEN:+ - Mail account is handled+ THEN:+ - Should not process any messages+ """+ account = MailAccount.objects.create(+ name="test",+ imap_server="",+ username="admin",+ password="secret",+ )+ MailRule.objects.create(+ name="testrule",+ account=account,+ action=MailRule.MailAction.MARK_READ,+ enabled=False,+ )++ self.mail_account_handler.handle_mail_account(account)+ self.mailMocker.apply_mail_actions()++ self.assertEqual(len(self.mailMocker.bogus_mailbox.messages), 3)+ self.assertEqual(len(self.mailMocker.bogus_mailbox.fetch("UNSEEN", False)), 2)++ self.mail_account_handler.handle_mail_account(account)+ self.mailMocker.apply_mail_actions()+ self.assertEqual(+ len(self.mailMocker.bogus_mailbox.fetch("UNSEEN", False)),+ 2,+ ) # still 2+class TestManagementCommand(TestCase):@mock.patch(