1
0
Fork 0

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

@ -180,6 +180,35 @@ class Processor
}
Item::update($item, ['uri' => $activity['id']]);
if ($activity['object_type'] == 'as:Event') {
$posts = Post::select(['event-id', 'uid'], ["`uri` = ? AND `event-id` > ?", $activity['id'], 0]);
while ($post = DBA::fetch($posts)) {
self::updateEvent($post['event-id'], $activity);
}
}
}
/**
* Update an existing event
*
* @param int $event_id
* @param array $activity
*/
private static function updateEvent(int $event_id, array $activity)
{
$event = DBA::selectFirst('event', [], ['id' => $event_id]);
$event['edited'] = DateTimeFormat::utc($activity['updated']);
$event['summary'] = HTML::toBBCode($activity['name']);
$event['desc'] = HTML::toBBCode($activity['content']);
$event['start'] = $activity['start-time'];
$event['finish'] = $activity['end-time'];
$event['nofinish'] = empty($event['finish']);
$event['location'] = $activity['location'];
Logger::info('Updating event', ['uri' => $activity['id'], 'id' => $event_id]);
Event::store($event);
}
/**