Skip to content

Commit

Permalink
Merge pull request #995 from josaphatim/fixed-issue-with-sieve-add-fi…
Browse files Browse the repository at this point in the history
…lter

Fixed add filter issues
  • Loading branch information
kroky authored May 7, 2024
2 parents 9fbf1aa + f6489e9 commit 836adb5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion modules/core/output_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ protected function output() {
if (!$this->get('router_login_state') && !empty($msgs)) {
$logged_out_class = ' logged_out';
}
$res .= '<div class="d-none z-3 position-fixed top-0 end-0 mt-3 me-3 sys_messages'.$logged_out_class.'">';
$res .= '<div class="d-none position-fixed top-0 end-0 mt-3 me-3 sys_messages'.$logged_out_class.'">';
if (!empty($msgs)) {
$res .= implode(',', array_map(function($v) {
if (preg_match("/ERR/", $v)) {
Expand Down
6 changes: 3 additions & 3 deletions modules/core/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,9 @@ div.unseen,
.next th {
white-space: normal !important;
}
.sys_messages {
z-index: 1100 !important;
}

/* mobile */
.mobile {
Expand Down Expand Up @@ -1029,9 +1032,6 @@ div.unseen,
top: 1px;
left: 70px !important;
}
.mobile .sys_messages {
z-index: 1000 !important;
}
@media (orientation: landscape) {
.mobile .msg_controls {
top: 12px;
Expand Down
1 change: 0 additions & 1 deletion modules/core/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ function Hm_Modal(options) {
}

btn.addEventListener('click', callback);
btn.addEventListener('click', this.hide);

this.modalFooter.append(btn);
};
Expand Down
11 changes: 7 additions & 4 deletions modules/sievefilters/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ $(function () {
**************************************************************************************/
var edit_script_modal = new Hm_Modal({
size: 'xl',
modalId: 'myEditScriptModal',
btnSize: 'lg'
modalId: 'myEditScript'
});

// set content
Expand Down Expand Up @@ -340,15 +339,15 @@ $(function () {
edit_filter_modal.addFooterBtn('Save', 'btn-primary ms-auto', async function () {
let result = save_filter(current_account);
if (result) {
edit_filter_modal.close();
edit_filter_modal.hide();
}
});

// add another button
edit_filter_modal.addFooterBtn('Convert to code', 'btn-warning', async function () {
let result = save_filter(current_account, true);
if (result) {
edit_filter_modal.close();
edit_filter_modal.hide();
}
});

Expand Down Expand Up @@ -908,6 +907,8 @@ $(function () {
current_account = $(this).attr('imap_account');
$('.modal_sieve_filter_name').val($(this).attr('script_name_parsed'));
$('.modal_sieve_filter_priority').val($(this).attr('priority'));
$('.sieve_list_conditions_modal').html('');
$('.filter_actions_modal_table').html('');
Hm_Ajax.request(
[ {'name': 'hm_ajax_hook', 'value': 'ajax_sieve_edit_filter'},
{'name': 'imap_account', 'value': $(this).attr('imap_account')},
Expand Down Expand Up @@ -935,6 +936,8 @@ $(function () {
$("[name^=sieve_selected_extra_action_value]").last().val(action.extra_option_value);
if ($("[name^=sieve_selected_action_value]").last().is('input')) {
$("[name^=sieve_selected_action_value]").last().val(action.value);
} else if ($("[name^=sieve_selected_action_value]").last().is('textarea')) {
$("[name^=sieve_selected_action_value]").last().text(action.value);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/modules/core/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ public function test_msgs() {
$test = new Output_Test('msgs', 'core');
$test->handler_response = array('router_login_state' => false);
$res = $test->run();
$this->assertEquals(array('<div class="d-none z-3 position-fixed top-0 end-0 mt-3 me-3 sys_messages logged_out"><div class="alert alert-danger alert-dismissible fade show" role="alert"><i class="bi bi-exclamation-triangle me-2"></i><span class="danger">foo</span>,<div class="alert alert-success alert-dismissible fade show" role="alert"><i class="bi bi-check-circle me-2"></i><span class="info">foo</span><button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div></div>'), $res->output_response);
$this->assertEquals(array('<div class="d-none position-fixed top-0 end-0 mt-3 me-3 sys_messages logged_out"><div class="alert alert-danger alert-dismissible fade show" role="alert"><i class="bi bi-exclamation-triangle me-2"></i><span class="danger">foo</span>,<div class="alert alert-success alert-dismissible fade show" role="alert"><i class="bi bi-check-circle me-2"></i><span class="info">foo</span><button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div></div>'), $res->output_response);
}
/**
* @preserveGlobalState disabled
Expand Down

0 comments on commit 836adb5

Please sign in to comment.