Calendar: Fix existing event filtering on push changes

Fixes new events did not show up
This commit is contained in:
nathangray 2020-07-27 10:13:13 -06:00
parent 2a500333ed
commit 10517cb073
3 changed files with 23 additions and 13 deletions

View File

@ -995,7 +995,7 @@ class calendar_uiforms extends calendar_ui
}
$response = Api\Json\Response::get();
if($response && $update_type != 'delete')
if($response && $update_type != 'delete' && !$client_updated)
{
$client_updated = $this->update_client($event['id']);
}
@ -1110,7 +1110,7 @@ class calendar_uiforms extends calendar_ui
}
// New event, send data before updating so it's there
$response = Api\Json\Response::get();
if($response && !$content['id'] && $event['id'])
if($response && !$content['id'] && $event['id'] && !$client_updated)
{
$client_updated = $this->update_client($event['id']);
}

View File

@ -578,17 +578,22 @@ var CalendarApp = /** @class */ (function (_super) {
// The event is outside our current view
return;
}
// Ask for the real data
// Do we already have "fresh" data? Most user actions give fresh data in response
var existing = egw.dataGetUIDdata('calendar::' + pushData.id);
if (existing && Math.abs(existing.timestamp - new Date().valueOf()) < 1000) {
// Update directly
this._update_events(this.state, ['calendar::' + pushData.id]);
return;
}
;
// Ask for the real data, we don't have it
egw.json("calendar.calendar_ui.ajax_get", [[pushData.id]], function (data) {
if (data && data.data && data.data.data)
return;
var unknown = (typeof egw.dataGetUIDdata(data.uid) === "undefined");
// Store it, which will call all registered listeners
egw.dataStoreUID(data.uid, data.data);
// Any existing events were updated. Run this to catch new events or events moved into view
if (unknown) {
this._update_events(this.state, [data.uid]);
}
this._update_events(this.state, [data.uid]);
}.bind(this)).sendRequest(true);
};
/**

View File

@ -520,19 +520,24 @@ class CalendarApp extends EgwApp
return;
}
// Ask for the real data
// Do we already have "fresh" data? Most user actions give fresh data in response
let existing = egw.dataGetUIDdata('calendar::'+pushData.id);
if(existing && Math.abs(existing.timestamp - new Date().valueOf()) < 1000)
{
// Update directly
this._update_events(this.state, ['calendar::'+pushData.id]);
return;
};
// Ask for the real data, we don't have it
egw.json("calendar.calendar_ui.ajax_get", [[pushData.id]], function(data) {
if(data && data.data && data.data.data) return;
let unknown = (typeof egw.dataGetUIDdata(data.uid) === "undefined");
// Store it, which will call all registered listeners
egw.dataStoreUID(data.uid, data.data);
// Any existing events were updated. Run this to catch new events or events moved into view
if(unknown)
{
this._update_events(this.state, [data.uid]);
}
this._update_events(this.state, [data.uid]);
}.bind(this)).sendRequest(true);
}