-
Notifications
You must be signed in to change notification settings - Fork 327
feat(sieve): implement redirecting action in filter UI #13095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||||||||||
| <!-- | ||||||||||||||||
| - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||||||||||||||||
| - SPDX-License-Identifier: AGPL-3.0-or-later | ||||||||||||||||
| --> | ||||||||||||||||
|
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Use the repository-required SPDX header block format in this new Vue file. The new file uses an HTML comment SPDX banner, but the guideline requires the C-style SPDX block format. 💡 Suggested fix-<!--
- - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- - SPDX-License-Identifier: AGPL-3.0-or-later
--->
+/* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */As per coding guidelines " 📝 Committable suggestion
Suggested change
Source: Coding guidelines |
||||||||||||||||
| <template> | ||||||||||||||||
| <NcTextField | ||||||||||||||||
| :required="true" | ||||||||||||||||
| :model-value="recipient" | ||||||||||||||||
| :label-outside="true" | ||||||||||||||||
| :placeholder="t('mail', 'Enter recipient')" | ||||||||||||||||
| @update:value="onInput" /> | ||||||||||||||||
| </template> | ||||||||||||||||
|
|
||||||||||||||||
| <script> | ||||||||||||||||
| import { NcTextField } from '@nextcloud/vue' | ||||||||||||||||
|
|
||||||||||||||||
| export default { | ||||||||||||||||
| name: 'ActionForward', | ||||||||||||||||
| components: { | ||||||||||||||||
| NcTextField, | ||||||||||||||||
| }, | ||||||||||||||||
|
|
||||||||||||||||
| props: { | ||||||||||||||||
| action: { | ||||||||||||||||
| type: Object, | ||||||||||||||||
| required: true, | ||||||||||||||||
| }, | ||||||||||||||||
|
|
||||||||||||||||
| account: { | ||||||||||||||||
| type: Object, | ||||||||||||||||
| required: true, | ||||||||||||||||
| }, | ||||||||||||||||
| }, | ||||||||||||||||
|
|
||||||||||||||||
| computed: { | ||||||||||||||||
| recipient() { | ||||||||||||||||
| return this.action.recipient ?? '' | ||||||||||||||||
| }, | ||||||||||||||||
| }, | ||||||||||||||||
|
|
||||||||||||||||
| methods: { | ||||||||||||||||
| onInput(value) { | ||||||||||||||||
| this.$emit('update-action', { recipient: value }) | ||||||||||||||||
| }, | ||||||||||||||||
| }, | ||||||||||||||||
| } | ||||||||||||||||
| </script> | ||||||||||||||||
|
|
||||||||||||||||
| <style lang="scss" scoped> | ||||||||||||||||
| .input-field { | ||||||||||||||||
| display: inline-block; /* for flex expand */ | ||||||||||||||||
| } | ||||||||||||||||
| </style> | ||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ export enum MailFilterConditionOperator { | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export enum MailFilterActions { | ||||||||||||||||||||||||||||||||||||
| AddSystemFlag = 'addsystemflag', | ||||||||||||||||||||||||||||||||||||
| Forward = 'forward', | ||||||||||||||||||||||||||||||||||||
| Stop = 'stop', | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -85,6 +86,15 @@ export class MailFilterActionStop implements MailFilterAction { | |||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export class MailFilterActionForward implements MailFilterAction { | ||||||||||||||||||||||||||||||||||||
| public id: number | ||||||||||||||||||||||||||||||||||||
| public type: string | ||||||||||||||||||||||||||||||||||||
| constructor() { | ||||||||||||||||||||||||||||||||||||
| this.id = randomId() | ||||||||||||||||||||||||||||||||||||
| this.type = 'forward' | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+89
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Initialize
💡 Suggested fix export class MailFilterActionForward implements MailFilterAction {
public id: number
public type: string
+ public recipient: string
constructor() {
this.id = randomId()
this.type = 'forward'
+ this.recipient = ''
}
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export class MailFilter { | ||||||||||||||||||||||||||||||||||||
| public id: number | ||||||||||||||||||||||||||||||||||||
| public name: string | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| [ | ||
| { | ||
| "name": "Test 9", | ||
| "enable": true, | ||
| "operator": "allof", | ||
| "tests": [ | ||
| { | ||
| "operator": "is", | ||
| "values": [ | ||
| "bob@example.org" | ||
| ], | ||
| "field": "to" | ||
| } | ||
| ], | ||
| "actions": [ | ||
| { | ||
| "type": "forward", | ||
| "flag": "alice@example.org" | ||
| } | ||
| ], | ||
|
Comment on lines
+15
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Field name mismatch between test fixture and implementation. Line 18 uses $recipient = SieveUtils::escapeString($action['recipient'])This will cause the forward action to fail at runtime because the expected field does not exist. The expected Sieve output in [functional_correctness, data_integrity_and_integration] 🐛 Proposed fix for test fixture field name "actions": [
{
"type": "forward",
- "flag": "alice@example.org"
+ "recipient": "alice@example.org"
}
], |
||
| "priority": 10 | ||
| } | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Hello, this is a test | ||
| ### Nextcloud Mail: Filters ### DON'T EDIT ### | ||
| # FILTER: [{"name":"Test 9","enable":true,"operator":"allof","tests":[{"operator":"is","values":["bob@example.org"],"field":"to"}],"actions":[{"type":"forward","recipient":"alice@example.org"}],"priority":10}] | ||
| # Test 9 | ||
| if address :is :all "To" ["bob@example.org"] { | ||
| redirect "alice@example.org"; | ||
| } | ||
| ### Nextcloud Mail: Filters ### DON'T EDIT ### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🔴 Critical
🧩 Analysis chain
🏁 Script executed:
Repository: nextcloud/mail
Length of output: 24829
🏁 Script executed:
# Get the MailFilterActionForward class definition from models ast-grep outline src/models/mailFilter.ts --match MailFilterActionForward --view expandedRepository: nextcloud/mail
Length of output: 320
🏁 Script executed:
Repository: nextcloud/mail
Length of output: 395
🏁 Script executed:
Repository: nextcloud/mail
Length of output: 152
🏁 Script executed:
Repository: nextcloud/mail
Length of output: 323
Fix fixture data integrity: forward action should use
recipientkey, notflag.The test fixture at
tests/data/mail-filter/builder9.jsoncontains aforwardaction with"flag": "alice@example.org", but the backend FilterBuilder consumesaction['recipient'](lib/Service/MailFilter/FilterBuilder.php:94) and the frontend ActionForward component emits{ recipient: value }.Additionally, the
MailFilterActionForwardmodel class (src/models/mailFilter.ts) lacks arecipientproperty definition.Fixture inconsistency
{ "type": "forward", "flag": "alice@example.org" }Should be:
{ "type": "forward", "recipient": "alice@example.org" }