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:
commit
f9e4f2a132
|
@ -138,22 +138,27 @@ class Processor
|
||||||
$item['changed'] = DateTimeFormat::utcNow();
|
$item['changed'] = DateTimeFormat::utcNow();
|
||||||
$item['edited'] = $activity['updated'];
|
$item['edited'] = $activity['updated'];
|
||||||
$item['title'] = HTML::toBBCode($activity['name']);
|
$item['title'] = HTML::toBBCode($activity['name']);
|
||||||
$item['content-warning'] = HTML::toBBCode($activity['summary']);
|
|
||||||
|
|
||||||
$content = HTML::toBBCode($activity['content']);
|
if (!empty($activity['source'])) {
|
||||||
$content = self::replaceEmojis($content, $activity['emojis']);
|
$content = $activity['source'];
|
||||||
$content = self::convertMentions($content);
|
} else {
|
||||||
|
$item['content-warning'] = HTML::toBBCode($activity['summary']);
|
||||||
|
|
||||||
if (($item['thr-parent'] != $item['uri']) && ($item['gravity'] == GRAVITY_COMMENT)) {
|
$content = HTML::toBBCode($activity['content']);
|
||||||
$parent = Item::selectFirst(['id', 'author-link', 'alias'], ['uri' => $item['thr-parent']]);
|
$content = self::replaceEmojis($content, $activity['emojis']);
|
||||||
if (!DBA::isResult($parent)) {
|
$content = self::convertMentions($content);
|
||||||
Logger::warning('Unknown parent item.', ['uri' => $item['thr-parent']]);
|
|
||||||
return;
|
if (($item['thr-parent'] != $item['uri']) && ($item['gravity'] == GRAVITY_COMMENT)) {
|
||||||
|
$parent = Item::selectFirst(['id', 'author-link', 'alias'], ['uri' => $item['thr-parent']]);
|
||||||
|
if (!DBA::isResult($parent)) {
|
||||||
|
Logger::warning('Unknown parent item.', ['uri' => $item['thr-parent']]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$potential_implicit_mentions = self::getImplicitMentionList($parent);
|
||||||
|
$content = self::removeImplicitMentionsFromBody($content, $potential_implicit_mentions);
|
||||||
|
$activity['tags'] = self::convertImplicitMentionsInTags($activity['tags'], $potential_implicit_mentions);
|
||||||
}
|
}
|
||||||
|
|
||||||
$potential_implicit_mentions = self::getImplicitMentionList($parent);
|
|
||||||
$content = self::removeImplicitMentionsFromBody($content, $potential_implicit_mentions);
|
|
||||||
$activity['tags'] = self::convertImplicitMentionsInTags($activity['tags'], $potential_implicit_mentions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['body'] = $content;
|
$item['body'] = $content;
|
||||||
|
@ -339,6 +344,7 @@ class Processor
|
||||||
$item = self::constructAttachList($activity['attachments'], $item);
|
$item = self::constructAttachList($activity['attachments'], $item);
|
||||||
|
|
||||||
if (!empty($activity['source'])) {
|
if (!empty($activity['source'])) {
|
||||||
|
$item['content-warning'] = '';
|
||||||
$item['body'] = $activity['source'];
|
$item['body'] = $activity['source'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ class Transmitter
|
||||||
return $data;
|
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']) {
|
if ($item['uri'] != $item['thr-parent']) {
|
||||||
$data['inReplyTo'] = $item['thr-parent'];
|
$data['inReplyTo'] = $item['thr-parent'];
|
||||||
|
@ -1056,7 +1056,7 @@ class Transmitter
|
||||||
if ($type == 'Note') {
|
if ($type == 'Note') {
|
||||||
$body = self::removePictures($body);
|
$body = self::removePictures($body);
|
||||||
} elseif (($type == 'Article') && empty($data['summary'])) {
|
} 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') {
|
if ($type == 'Event') {
|
||||||
|
|
Loading…
Reference in a new issue