-
Notifications
You must be signed in to change notification settings - Fork 154
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
[ENH] Added functionality to enable or disable Sieve Filters with toggle button #1104
base: master
Are you sure you want to change the base?
Conversation
a8bd54f
to
b330c2b
Compare
fb9dc09
to
0bd8033
Compare
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.
Please make sure all tests pass successfully and also remove composer.lock it will be supported by this #1093 because we have some changes that must be applied in sievefilters/modules.php before.
aedb2a1
to
fd4fdf2
Compare
hello @Shadow243 . I deleted the composer.lock file as you requested in your previous comment and all the tests passed successfully. please review |
Sorry, but there is another conflict. |
fd4fdf2
to
37133d4
Compare
hello @marclaporte . conflict has been resolved |
@@ -34,7 +34,7 @@ public function process() { | |||
$this->out('conditions', json_encode(base64_decode($base64_obj))); | |||
$base64_obj = str_replace("# ", "", preg_split('#\r?\n#', $script, 0)[2]); | |||
$this->out('actions', json_encode(base64_decode($base64_obj))); | |||
if (mb_strstr($script, 'allof')) { | |||
if (strstr($script, 'allof')) { |
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.
Is this intentional?
I am wondering because of #1224
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.
We should keep multibyte functions in 99% of the places. There was only one exception when the size of a string was specified in bytes in the IMAP protocol (literals).
modules/sievefilters/modules.php
Outdated
@@ -223,7 +263,7 @@ public function process() { | |||
$blocked_wildcard = '@'.$domain; | |||
$new_blocked_list = []; | |||
foreach ($blocked_list as $idx => $blocked_sender) { | |||
if (!mb_strstr($blocked_sender, $blocked_wildcard)) { | |||
if (!strstr($blocked_sender, $blocked_wildcard)) { |
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.
Is this intentional?
I am wondering because of #1224
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.
no it was not intentional. I understand, I correct
modules/sievefilters/modules.php
Outdated
@@ -635,7 +675,7 @@ public function process() { | |||
$script_name = generate_filter_name($this->request->post['sieve_filter_name'], $priority); | |||
$conditions = json_decode($this->request->post['conditions_json']); | |||
$actions = json_decode($this->request->post['actions_json']); | |||
$test_type = mb_strtolower($this->request->post['filter_test_type']); | |||
$test_type = strtolower($this->request->post['filter_test_type']); |
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.
Is this intentional?
I am wondering because of #1224
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.
no it was not intentional. I understand, I correct
composer.json
Outdated
@@ -46,7 +46,7 @@ | |||
"ext-openssl": "*", | |||
"ext-session": "*", | |||
"ezyang/htmlpurifier": "^4.17", | |||
"henrique-borba/php-sieve-manager": "^1.0", | |||
"henrique-borba/php-sieve-manager": "~1.0.4", |
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.
We don't want such a hard constraint to this lib. It will prevent upgrades of the lib for non-major versions as 1.1.0.
); | ||
} | ||
if ($action->action == 'flag') { | ||
$custom_condition->addAction( | ||
new \PhpSieveManager\Filters\Actions\FlagFilterAction(['flags' => [$action->value]]) | ||
new \PhpSieveManager\Filters\Actions\FlagFilterAction([$action->value]) |
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.
Why do you change all these FilterAction calls to constructors? I believe php-sieve-manager still expects the params in an associative array, doesn't it?
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.
yes
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.
@kroky means that php-sieve-manager
expects to receive associative arrays. with the changes you have applied, it will break sieve.
768e378
to
5929ff7
Compare
Hello @kroky |
86542ca
to
6ccac96
Compare
…' of https://github.com/amaninyumu1/cypht into add-a-toggle-top-activate-deactivate-a-Cypht-Sieve-rule
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.
It seems to me that you did a rebase which removed some important behavior. Can you review this PR carefully?
composer.json
Outdated
@@ -46,7 +46,7 @@ | |||
"ext-openssl": "*", | |||
"ext-session": "*", | |||
"ezyang/htmlpurifier": "^4.17", | |||
"henrique-borba/php-sieve-manager": "^1.0", | |||
"henrique-borba/php-sieve-manager": "~1.0.4", |
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.
You don't need this too
); | ||
} | ||
if ($action->action == 'flag') { | ||
$custom_condition->addAction( | ||
new \PhpSieveManager\Filters\Actions\FlagFilterAction(['flags' => [$action->value]]) | ||
new \PhpSieveManager\Filters\Actions\FlagFilterAction([$action->value]) |
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.
@kroky means that php-sieve-manager
expects to receive associative arrays. with the changes you have applied, it will break sieve.
@@ -130,13 +130,6 @@ var hm_sieve_possible_actions = function() { | |||
type: 'string', | |||
extra_field: false | |||
}, | |||
{ |
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.
we are using this filter at https://github.com/cypht-org/cypht/blob/master/modules/sievefilters/modules.php#L915
I mean I don't understand why you are deleting this here.
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.
From what I understand, the value $action->value passed into the addAction method is not explicitly an associative array in the current implementation. Could you please explain to me how this change might "break" sieve's behavior? It would help me better understand the issue and ensure that the implementation meets the expectations of PhpSieveManager. thanks
@@ -539,12 +532,6 @@ $(function () { | |||
$('#stop_filtering').prop('checked', false); | |||
current_account = $(this).attr('account'); | |||
edit_filter_modal.open(); | |||
|
|||
// Reset the form fields when opening the modal | |||
$(".modal_sieve_filter_name").val(''); |
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.
By deleting this code, the form starts to keep the previous data again because it is this code which resets when we click on add again.
@@ -1179,9 +1216,6 @@ protected function output() { | |||
$res .= get_script_modal_content(); | |||
$res .= '<div class="p-3">'; | |||
foreach($mailboxes as $idx => $mailbox) { | |||
if (empty($mailbox['sieve_config_host'])) { |
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.
This condition remains important, isn't it?
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.
Yes
No description provided.