From 08acad038c58c244dadac8e7962ef0eb009338ed Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 29 Jul 2020 13:58:02 +0200 Subject: [PATCH] * Mail: replying to a mail should only update icon, not move it to top of list --- api/js/etemplate/et2_extension_nextmatch.js | 4 ++++ api/js/etemplate/et2_extension_nextmatch.ts | 4 ++++ api/js/jsapi/egw_global.d.ts | 1 + api/js/jsapi/egw_message.js | 1 + mail/inc/class.mail_compose.inc.php | 7 +++++-- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 99743492e1..d5da1fff10 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -433,6 +433,7 @@ var et2_nextmatch = /** @class */ (function (_super) { * Change type parameters allows for quicker refresh then complete server side reload: * - update: request just modified data from given rows. Sorting is not considered, * so if the sort field is changed, the row will not be moved. + * - update-in-place: update row, but do NOT move it, or refresh if uid does not exist * - edit: rows changed, but sorting may be affected. May require full reload. * - delete: just delete the given rows clientside (no server interaction neccessary) * - add: put the new row in at the top, unless app says otherwise @@ -504,6 +505,9 @@ var et2_nextmatch = /** @class */ (function (_super) { id_loop: for (var i = 0; i < _row_ids.length; i++) { var uid = _row_ids[i].toString().indexOf(this.controller.dataStorePrefix) == 0 ? _row_ids[i] : this.controller.dataStorePrefix + "::" + _row_ids[i]; switch (_type) { + case "update-in-place": + this.egw().dataRefreshUID(uid); + break; case "edit": case "update": if (!this.refresh_update(uid)) { diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 2c47b699db..5bdb20d114 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -681,6 +681,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 * Change type parameters allows for quicker refresh then complete server side reload: * - update: request just modified data from given rows. Sorting is not considered, * so if the sort field is changed, the row will not be moved. + * - update-in-place: update row, but do NOT move it, or refresh if uid does not exist * - edit: rows changed, but sorting may be affected. May require full reload. * - delete: just delete the given rows clientside (no server interaction neccessary) * - add: put the new row in at the top, unless app says otherwise @@ -769,6 +770,9 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 var uid = _row_ids[i].toString().indexOf(this.controller.dataStorePrefix) == 0 ? _row_ids[i] : this.controller.dataStorePrefix + "::" + _row_ids[i]; switch(_type) { + case "update-in-place": + this.egw().dataRefreshUID(uid); + break; case "edit": case "update": if(!this.refresh_update(uid)) diff --git a/api/js/jsapi/egw_global.d.ts b/api/js/jsapi/egw_global.d.ts index 7f61f0009f..778c609299 100644 --- a/api/js/jsapi/egw_global.d.ts +++ b/api/js/jsapi/egw_global.d.ts @@ -875,6 +875,7 @@ declare interface IegwWndLocal extends IegwGlobal * @param {string} _type either 'update', 'edit', 'delete', 'add' or null * - update: request just modified data from given rows. Sorting is not considered, * so if the sort field is changed, the row will not be moved. + * - update-in-place: update row, but do NOT move it, or refresh if uid does not exist * - edit: rows changed, but sorting may be affected. Requires full reload. * - delete: just delete the given rows clientside (no server interaction neccessary) * - add: requires full reload for proper sorting diff --git a/api/js/jsapi/egw_message.js b/api/js/jsapi/egw_message.js index 62de529d81..078cb03b01 100644 --- a/api/js/jsapi/egw_message.js +++ b/api/js/jsapi/egw_message.js @@ -319,6 +319,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd) * @param {string} _type either 'update', 'edit', 'delete', 'add' or null * - update: request just modified data from given rows. Sorting is not considered, * so if the sort field is changed, the row will not be moved. + * - update-in-place: update row, but do NOT move it, or refresh if uid does not exist * - edit: rows changed, but sorting may be affected. Requires full reload. * - delete: just delete the given rows clientside (no server interaction neccessary) * - add: requires full reload for proper sorting diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 253e2ef901..af9ba28cfa 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -570,6 +570,7 @@ class mail_compose { $rhA = mail_ui::splitRowID($_content['processedmail_id']); $idsForRefresh[] = mail_ui::generateRowID($rhA['profileID'], $rhA['folder'], $rhA['msgUID'], $_prependApp=false); + $workingFolder = $rhA['folder']; // need folder to refresh eg. drafts folder } $response = Api\Json\Response::get(); if ($activeProfile != $composeProfile) @@ -577,17 +578,19 @@ class mail_compose // we need a message only, when account ids (composeProfile vs. activeProfile) differ $response->call('opener.egw_message',lang('Message send successfully.')); } - elseif ($activeProfile == $composeProfile && ($workingFolder==$activeFolder['mailbox'] && $mode != 'compose') || ($this->mail_bo->isSentFolder($workingFolder)||$this->mail_bo->isDraftFolder($workingFolder))) + elseif ($activeProfile == $composeProfile && ($workingFolder==$activeFolder['mailbox'] && $mode != 'compose') || + ($this->mail_bo->isSentFolder($workingFolder) || $this->mail_bo->isDraftFolder($workingFolder))) { if ($this->mail_bo->isSentFolder($workingFolder)||$this->mail_bo->isDraftFolder($workingFolder)) { // we may need a refresh when on sent folder or in drafts, as drafted messages will/should be deleted after succeeded send action $response->call('opener.egw_refresh',lang('Message send successfully.'),'mail'); } + // we only need to update the icon of the replied or forwarded mails --> 'update-in-place' else { //error_log(__METHOD__.__LINE__.array2string($idsForRefresh)); - $response->call('opener.egw_refresh',lang('Message send successfully.'),'mail',$idsForRefresh,'update'); + $response->call('opener.egw_refresh',lang('Message send successfully.'),'mail',$idsForRefresh,'update-in-place'); } } else