From af4a605561ca98220b187ce52f0347e80833e2d8 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 14 Aug 2020 12:38:29 +0200 Subject: [PATCH] * Timesheet: fix list not always refreshed via push, caused by owner filter --- timesheet/js/app.js | 7 ++++++- timesheet/js/app.ts | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/timesheet/js/app.js b/timesheet/js/app.js index 21bd2915c5..ad5428e0eb 100644 --- a/timesheet/js/app.js +++ b/timesheet/js/app.js @@ -194,6 +194,11 @@ var TimesheetApp = /** @class */ (function (_super) { if (pushData.type === 'delete') { return _super.prototype.push.call(this, pushData); } + // This must be before all ACL checks, as owner might have changed and entry need to be removed + // (server responds then with null / no entry causing the entry to disapear) + if (pushData.type !== "add" && this.egw.dataHasUID(this.uid(pushData))) { + return etemplate2_1.etemplate2.app_refresh("", pushData.app, pushData.id, pushData.type); + } // all other cases (add, edit, update) are handled identical // check visibility if (typeof this._grants === 'undefined') { @@ -204,7 +209,7 @@ var TimesheetApp = /** @class */ (function (_super) { // check if we might not see it because of an owner filter var nm = (_a = this.et2) === null || _a === void 0 ? void 0 : _a.getWidgetById('nm'); var nm_value = (_b = nm) === null || _b === void 0 ? void 0 : _b.getValue(); - if (nm && nm_value && ((_c = nm_value.col_filter) === null || _c === void 0 ? void 0 : _c.ts_owner) && nm_value.col_filter.ts_owner != pushData.acl) { + if (nm && nm_value && ((_c = nm_value.col_filter) === null || _c === void 0 ? void 0 : _c.ts_owner) && nm_value.col_filter.ts_owner != pushData.acl.ts_owner) { return; } etemplate2_1.etemplate2.app_refresh("", pushData.app, pushData.id, pushData.type); diff --git a/timesheet/js/app.ts b/timesheet/js/app.ts index 3ffb502410..d25f2110cc 100644 --- a/timesheet/js/app.ts +++ b/timesheet/js/app.ts @@ -225,6 +225,13 @@ class TimesheetApp extends EgwApp return super.push(pushData); } + // This must be before all ACL checks, as owner might have changed and entry need to be removed + // (server responds then with null / no entry causing the entry to disapear) + if (pushData.type !== "add" && this.egw.dataHasUID(this.uid(pushData))) + { + return etemplate2.app_refresh("", pushData.app, pushData.id, pushData.type); + } + // all other cases (add, edit, update) are handled identical // check visibility if (typeof this._grants === 'undefined') @@ -236,7 +243,7 @@ class TimesheetApp extends EgwApp // check if we might not see it because of an owner filter let nm = this.et2?.getWidgetById('nm'); let nm_value = nm?.getValue(); - if (nm && nm_value && nm_value.col_filter?.ts_owner && nm_value.col_filter.ts_owner != pushData.acl) + if (nm && nm_value && nm_value.col_filter?.ts_owner && nm_value.col_filter.ts_owner != pushData.acl.ts_owner) { return; }