[NOTICES] Add data-nosnippet attribute for notices by remote profiles

This commit is contained in:
Diogo Cordeiro
2020-01-09 19:49:49 +00:00
committed by Diogo Peralta Cordeiro
parent 570fc17e8a
commit 0204ffb1fa
3 changed files with 50 additions and 15 deletions

View File

@@ -564,7 +564,15 @@ abstract class ActivityHandlerPlugin extends Plugin
protected function openNoticeListItemElement(NoticeListItem $nli)
{
// Build up the attributes
$attrs = [];
// -> The id
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
$id_decl = "notice-{$id}";
$attrs['id'] = $id_decl;
// -> The class
$class = 'h-entry notice ' . $this->tag();
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
$class .= ' limited-scope';
@@ -574,8 +582,14 @@ abstract class ActivityHandlerPlugin extends Plugin
} catch (Exception $e) {
// either source or what we filtered out was a zero-length string
}
$nli->out->elementStart('li', array('class' => $class,
'id' => 'notice-' . $id));
$attrs['class'] = $class;
// -> Robots
if (!$nli->notice->isLocal()) {
$attrs['data-nosnippet'] = 'true';
}
$nli->out->elementStart('li', $attrs);
}
protected function closeNoticeListItemElement(NoticeListItem $nli)