Merge pull request #11893 from annando/issue-11890

Issue 11890: Don't use empty contexts
This commit is contained in:
Philipp 2022-09-06 18:24:36 +02:00 committed by GitHub
commit f0622163b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -1869,8 +1869,10 @@ class Receiver
$object_data['diaspora:comment'] = JsonLD::fetchElement($object, 'diaspora:comment', '@value');
$object_data['diaspora:like'] = JsonLD::fetchElement($object, 'diaspora:like', '@value');
$object_data['actor'] = $object_data['author'] = $actor;
$object_data['context'] = JsonLD::fetchElement($object, 'as:context', '@id');
$object_data['conversation'] = JsonLD::fetchElement($object, 'ostatus:conversation', '@id');
$element = JsonLD::fetchElement($object, 'as:context', '@id');
$object_data['context'] = $element != './' ? $element : null;
$element = JsonLD::fetchElement($object, 'ostatus:conversation', '@id');
$object_data['conversation'] = $element != './' ? $element : null;
$object_data['sensitive'] = JsonLD::fetchElement($object, 'as:sensitive');
$object_data['name'] = JsonLD::fetchElement($object, 'as:name', '@value');
$object_data['summary'] = JsonLD::fetchElement($object, 'as:summary', '@value');

View file

@ -1610,7 +1610,10 @@ class Transmitter
$data['url'] = $link ?? $item['plink'];
$data['attributedTo'] = $item['author-link'];
$data['sensitive'] = self::isSensitive($item['uri-id']);
$data['conversation'] = $data['context'] = ($item['conversation'] ?? '');
if (!empty($item['conversation']) && ($item['conversation'] != './')) {
$data['conversation'] = $data['context'] = $item['conversation'];
}
if (!empty($item['title'])) {
$data['name'] = BBCode::toPlaintext($item['title'], false);