Skip to content

Commit 3c0db75

Browse files
authored
fix(frontend/backend): address some of the many blocking issues (#1443)
* fix(frontend): prevent Cypht-related mobile nav CSS attributes from overriding third-party styles * fix(backend): showing server sieve capabilities * fix(frontend): git revision link not opening the remote url * fix(frontend): fadeOutAndRemove should not only be extended to cash but also to jQuery * fix(frontend): refresh ui state when adding a server * fix(backend): adding accounts via files imports * fix(backend): downloading server accounts sample files in third-party softwares * fix elements spacing of the search page * fix(backend): offline error message when hihandling a message action or deleting a folder * fix(frontend): hide the refresh icon on the search page as it's replaced by the update button * fix(frontend): delete a saved search term * fix(backend): undefined array key warnings when listing folders' messages * fix(frontend): ensure that a search operation updates the cached pages results * fix(frontend): ensure that a filter operation updates the cached pages results * fix(frontend): when opening an unread message, the counter does not get updated * fix(frontend): Snooze - Pick a date does not show a date picke * fix(frontend): remove the deleted message from the store when a delete action has been performed
1 parent 62e9174 commit 3c0db75

File tree

29 files changed

+205
-120
lines changed

29 files changed

+205
-120
lines changed
File renamed without changes.
File renamed without changes.

index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
define('SITE_ID', '');
2323
define('JS_HASH', '');
2424
define('CSS_HASH', '');
25+
define('ASSETS_PATH', APP_PATH.'assets/');
2526

2627
/* show all warnings in debug mode */
2728
if (DEBUG_MODE) {

modules/core/js_modules/Hm_MessagesStore.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class Hm_MessagesStore {
1515
* @property {RowObject} 1 - An object containing the row message and the IMAP key
1616
*/
1717

18-
constructor(path, page = 1, rows = {}, abortController = new AbortController()) {
18+
constructor(path, page = 1, filter = '', rows = {}, abortController = new AbortController()) {
1919
this.path = path;
20-
this.list = path + '_' + page;
20+
this.list = path + '_' + (filter ? filter + '_': '') + page;
2121
this.rows = rows;
2222
this.count = 0;
2323
this.flagAsReadOnOpen = true;
@@ -140,6 +140,17 @@ class Hm_MessagesStore {
140140
}
141141

142142
}
143+
144+
updateRow(uid, html) {
145+
const rows = Object.entries(this.rows);
146+
const row = this.getRowByUid(uid)?.value;
147+
if (row) {
148+
const objectRows = Object.fromEntries(rows);
149+
objectRows[row[0]]['0'] = html;
150+
this.rows = objectRows;
151+
this.#saveToLocalStorage();
152+
}
153+
}
143154

144155
#fetch(hideLoadingState = false) {
145156
return new Promise((resolve, reject) => {

modules/core/js_modules/[cash]/extend.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ $.fn.fadeOut = function(timeout = 600) {
4040
return this.css("opacity", 0)
4141
.css("transition", `opacity ${timeout}ms`)
4242
};
43-
$.fn.fadeOutAndRemove = function(timeout = 600) {
44-
this.fadeOut(timeout)
45-
var tm = setTimeout(() => {
46-
this.remove();
47-
clearTimeout(tm)
48-
}, timeout);
49-
return this;
50-
};
5143

5244
$.fn.modal = function(action) {
5345
const modalElement = this[0];

modules/core/js_modules/actions/pagination.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function nextPage() {
2020

2121
const nextPage = parseInt(currentPage) + 1;
2222

23-
const store = new Hm_MessagesStore(getListPathParam(), currentPage);
23+
const store = new Hm_MessagesStore(getListPathParam(), currentPage, `${getParam('keyword')}_${getParam('filter')}`);
2424
store.load(false, false, true);
2525

2626
await changePage(nextPage, this, store.offsets);
@@ -33,7 +33,7 @@ async function previousPage() {
3333

3434
let offsets = '';
3535
if (previousPage > 1) {
36-
const store = new Hm_MessagesStore(getListPathParam(), previousPage - 1);
36+
const store = new Hm_MessagesStore(getListPathParam(), previousPage - 1, `${getParam('keyword')}_${getParam('filter')}`);
3737
store.load(false, false, true);
3838
offsets = store.offsets;
3939
}
@@ -61,11 +61,11 @@ async function changePage(toPage, button, offsets) {
6161
history.pushState(history.state, "", url.toString());
6262
window.location.next = url.search;
6363

64-
const messagesStore = new Hm_MessagesStore(getListPathParam(), toPage);
64+
const messagesStore = new Hm_MessagesStore(getListPathParam(), toPage, `${getParam('keyword')}_${getParam('filter')}`);
6565
try {
6666
await messagesStore.load();
6767
Hm_Utils.tbody().attr('id', messagesStore.list);
68-
display_imap_mailbox(messagesStore.rows, null, messagesStore.list);
68+
display_imap_mailbox(messagesStore.rows, null, messagesStore.list, messagesStore);
6969
$(".pagination .current").text(toPage);
7070
} catch (error) {
7171
Hm_Notices.show("Failed to fetch content", "danger");

modules/core/js_modules/actions/sortCombinedLists.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ async function sortCombinedLists(sortValue) {
22
const url = new URL(window.location.href);
33
url.searchParams.set('sort', sortValue);
44

5-
history.pushState(null, null, url.toString());
5+
history.pushState(history.state, null, url.toString());
66
location.next = url.search;
7-
const messagesStore = new Hm_MessagesStore(getListPathParam(), getParam('page'));
7+
const messagesStore = new Hm_MessagesStore(getListPathParam(), getParam('page'), `${getParam('keyword')}_${getParam('filter')}`);
88
try {
99
await messagesStore.load(true);
1010
Hm_Utils.tbody().attr('id', messagesStore.list);
11-
display_imap_mailbox(messagesStore.rows, null, messagesStore.list);
11+
display_imap_mailbox(messagesStore.rows, messagesStore.list, messagesStore);
1212
} catch (error) {
1313
Hm_Notices.show('Failed to load messages', 'danger');
1414
}

modules/core/js_modules/route_handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function applyInfoPageHandlers() {
7070
function applyMessaleListPageHandlers(routeParams) {
7171
sortHandlerForMessageListAndSearchPage();
7272
Hm_Message_List.set_row_events();
73-
const messagesStore = new Hm_MessagesStore(routeParams.list_path, routeParams.list_page);
73+
const messagesStore = new Hm_MessagesStore(routeParams.list_path, routeParams.list_page, `${routeParams.keyword}_${routeParams.filter}`);
7474
Hm_Utils.tbody().attr('id', messagesStore.list);
7575

7676
$('.core_msg_control').on("click", function(e) {

modules/core/js_modules/utils/sortable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ function handleMessagesDragAndDrop() {
7676
{'name': 'imap_move_page', 'value': page},
7777
{'name': 'imap_move_action', 'value': 'move'}],
7878
async (res) =>{
79-
const store = new Hm_MessagesStore(getListPathParam(), Hm_Utils.get_url_page_number());
79+
const store = new Hm_MessagesStore(getListPathParam(), Hm_Utils.get_url_page_number(), `${getParam('keyword')}_${getParam('filter')}`);
8080
await store.load(false, true, true);
8181
const moveResponses = Object.values(res['move_responses']);
8282
moveResponses.forEach((response) => {
8383
store.removeRow(response.oldUid);
8484
});
85-
display_imap_mailbox(store.rows, store.list);
85+
display_imap_mailbox(store.rows, store.list, store);
8686
}
8787
);
8888

modules/core/message_list_functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ function message_since_dropdown($since, $name, $output_mod, $original_default_va
446446
'-1 year' => 'Last year',
447447
'-5 years' => 'Last 5 years'
448448
);
449-
$res = '<select name="'.$name.'" id="'.$name.'" class="message_list_since form-select form-select-sm w-auto" data-default-value="'.$original_default_value.'">';
449+
$res = '<select name="'.$name.'" id="'.$name.'" class="message_list_since form-select form-select-sm" data-default-value="'.$original_default_value.'">';
450450
$reset = '';
451451
foreach ($times as $val => $label) {
452452
$res .= '<option';
@@ -606,7 +606,7 @@ function search_field_selection($current, $output_mod) {
606606
'TO' => 'To',
607607
'CC' => 'Cc',
608608
);
609-
$res = '<select class="form-select form-select-sm w-auto" id="search_fld" name="search_fld">';
609+
$res = '<select class="form-select form-select-sm" id="search_fld" name="search_fld">';
610610
foreach ($flds as $val => $name) {
611611
$res .= '<option ';
612612
if ($current == $val) {

0 commit comments

Comments
 (0)