Merge pull request #11209 from annando/issue-10365-Events

Issue 10365: Event updates are now processed
This commit is contained in:
Hypolite Petovan 2022-02-05 12:08:00 -05:00 committed by GitHub
commit 121e40357c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View file

@ -1428,6 +1428,17 @@ class Item
private static function storeForUser(array $item, int $uid)
{
if (Post::exists(['uri-id' => $item['uri-id'], 'uid' => $uid])) {
if (!empty($item['event-id'])) {
$post = Post::selectFirst(['event-id'], ['uri-id' => $item['uri-id'], 'uid' => $uid]);
if (!empty($post['event-id'])) {
$event = DBA::selectFirst('event', ['edited', 'start', 'finish', 'summary', 'desc', 'location', 'nofinish', 'adjust'], ['id' => $item['event-id']]);
if (!empty($event)) {
// We aren't using "Event::store" here, since we don't want to trigger any further action
$ret = DBA::update('event', $event, ['id' => $post['event-id']]);
Logger::info('Event updated', ['uid' => $uid, 'source-event' => $item['event-id'], 'target-event' => $post['event-id'], 'ret' => $ret]);
}
}
}
Logger::info('Item already exists', ['uri-id' => $item['uri-id'], 'uid' => $uid]);
return 0;
}