Fix ownyourswarm checkins (closes issue #93)

Squashed commit of the following:

commit b9716fc406664a58ce506aa419f978853d698eff
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sat Jan 26 15:30:43 2019 +0000

    Location and checkin aren’t part of the properties anymore
This commit is contained in:
Jonny Barnes 2019-01-26 15:38:18 +00:00
parent 11a26e80e0
commit acbb04f5a9
3 changed files with 130 additions and 80 deletions

View file

@ -139,18 +139,7 @@ class NoteService
*/
private function getCheckin(array $request): ?Place
{
$location = array_get($request, 'properties.location.0');
if (array_get($location, 'type.0') === 'h-card') {
try {
$place = resolve(PlaceService::class)->createPlaceFromCheckin(
$location
);
} catch (\InvalidArgumentException $e) {
return null;
}
return $place;
}
$location = array_get($request, 'location');
if (is_string($location) && starts_with($location, config('app.url'))) {
return Place::where(
'slug',
@ -162,10 +151,21 @@ class NoteService
)
)->first();
}
if (array_get($request, 'properties.checkin')) {
if (array_get($request, 'checkin')) {
try {
$place = resolve(PlaceService::class)->createPlaceFromCheckin(
array_get($request, 'properties.checkin.0')
array_get($request, 'checkin')
);
} catch (\InvalidArgumentException $e) {
return null;
}
return $place;
}
if (array_get($location, 'type.0') === 'h-card') {
try {
$place = resolve(PlaceService::class)->createPlaceFromCheckin(
$location
);
} catch (\InvalidArgumentException $e) {
return null;