1
1
Fork 0

Merge pull request #6894 from annando/fix-summary

Summary has to be converted to HTML / Don't use summary when we have the source
This commit is contained in:
Hypolite Petovan 2019-03-17 09:11:29 -04:00 committed by GitHub
commit f9e4f2a132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 15 deletions

View file

@ -138,6 +138,10 @@ class Processor
$item['changed'] = DateTimeFormat::utcNow();
$item['edited'] = $activity['updated'];
$item['title'] = HTML::toBBCode($activity['name']);
if (!empty($activity['source'])) {
$content = $activity['source'];
} else {
$item['content-warning'] = HTML::toBBCode($activity['summary']);
$content = HTML::toBBCode($activity['content']);
@ -155,6 +159,7 @@ class Processor
$content = self::removeImplicitMentionsFromBody($content, $potential_implicit_mentions);
$activity['tags'] = self::convertImplicitMentionsInTags($activity['tags'], $potential_implicit_mentions);
}
}
$item['body'] = $content;
$item['tag'] = self::constructTagString($activity['tags'], $activity['sensitive']);
@ -339,6 +344,7 @@ class Processor
$item = self::constructAttachList($activity['attachments'], $item);
if (!empty($activity['source'])) {
$item['content-warning'] = '';
$item['body'] = $activity['source'];
}

View file

@ -1021,7 +1021,7 @@ class Transmitter
return $data;
}
$data['summary'] = BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB);
$data['summary'] = BBCode::convert(BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB), false, 7);
if ($item['uri'] != $item['thr-parent']) {
$data['inReplyTo'] = $item['thr-parent'];
@ -1056,7 +1056,7 @@ class Transmitter
if ($type == 'Note') {
$body = self::removePictures($body);
} elseif (($type == 'Article') && empty($data['summary'])) {
$data['summary'] = Plaintext::shorten(self::removePictures($body), 1000);
$data['summary'] = BBCode::convert(Plaintext::shorten(self::removePictures($body), 1000), false, 7);
}
if ($type == 'Event') {