[PLUGIN][ActivityPub] Improve has/get checks
Fixes an issue where GtS posts were not being processed because of stripped @context
This commit is contained in:
parent
c3477ea56b
commit
2da614e344
|
@ -144,7 +144,7 @@ class Note extends Model
|
||||||
|
|
||||||
// Figure the locale of the note when possible
|
// Figure the locale of the note when possible
|
||||||
$locale = null;
|
$locale = null;
|
||||||
if (\is_array($type_note->get('@context'))) {
|
if ($type_note->has('@context') && \is_array($type_note->get('@context'))) {
|
||||||
$locale = array_column($type_note->get('@context'), '@language');
|
$locale = array_column($type_note->get('@context'), '@language');
|
||||||
if ($locale !== []) {
|
if ($locale !== []) {
|
||||||
$locale = $locale[0];
|
$locale = $locale[0];
|
||||||
|
@ -241,7 +241,7 @@ class Note extends Model
|
||||||
$map['content'] = $type_note->get('content') ?? null;
|
$map['content'] = $type_note->get('content') ?? null;
|
||||||
$map['content_type'] = \is_null($map['content']) ? null : 'text/html';
|
$map['content_type'] = \is_null($map['content']) ? null : 'text/html';
|
||||||
$map['rendered'] = \is_null($map['content']) ? null : HTML::sanitize($map['content']);
|
$map['rendered'] = \is_null($map['content']) ? null : HTML::sanitize($map['content']);
|
||||||
if ($type_note->has('source')) {
|
if ($type_note->has('source') && !empty($type_note->get('source'))) {
|
||||||
$map['content_type'] = $type_note->get('source')['mediaType'] ?? null;
|
$map['content_type'] = $type_note->get('source')['mediaType'] ?? null;
|
||||||
$map['content'] = $type_note->get('source')['content'];
|
$map['content'] = $type_note->get('source')['content'];
|
||||||
if (\is_null($map['rendered'])) {
|
if (\is_null($map['rendered'])) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user