Ignore (for now), OwnYourSwarm requests with h-adr location value

This commit is contained in:
Jonny Barnes 2018-02-17 21:50:46 +00:00
parent 8ddab8b1de
commit 79d0e78905

View file

@ -142,10 +142,11 @@ class NoteService
*/ */
private function getCheckin(array $request): ?Place private function getCheckin(array $request): ?Place
{ {
if (array_get($request, 'properties.location.0.type.0') === 'h-card') { $location = array_get($request, 'properties.location.0');
if (array_get($location, 'type.0') === 'h-card') {
try { try {
$place = resolve(PlaceService::class)->createPlaceFromCheckin( $place = resolve(PlaceService::class)->createPlaceFromCheckin(
array_get($request, 'properties.location.0') $location
); );
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
return null; return null;
@ -153,12 +154,12 @@ class NoteService
return $place; return $place;
} }
if (starts_with(array_get($request, 'properties.location.0'), config('app.url'))) { if (is_string($location) && starts_with($location, config('app.url'))) {
return Place::where( return Place::where(
'slug', 'slug',
basename( basename(
parse_url( parse_url(
array_get($request, 'properties.location.0'), $location,
PHP_URL_PATH PHP_URL_PATH
) )
) )