From 1e7d61af9cf501230edce8c37d228f10a0d1a986 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Fri, 28 Jun 2024 12:28:06 +1000 Subject: [PATCH] lemmy comment controls --- src/Lib/Activity.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Lib/Activity.php b/src/Lib/Activity.php index 31cb6580a..2a2356f55 100644 --- a/src/Lib/Activity.php +++ b/src/Lib/Activity.php @@ -3320,6 +3320,11 @@ class Activity $item['edited'] = $item['created']; } + // lemmy comment controls + if (isset($act->obj['commentEnabled']) && !$act->obj['commentsEnabled']) { + $item['comment_policy'] = 'none'; + } + if ($item['mid'] === $item['parent_mid']) { // it is a parent node - decode the comment policy info if present if ($act->objprop('commentPolicy')) { @@ -4680,6 +4685,17 @@ class Activity $item['body'] .= "\n\n" . '[audio]' . $a['href'] . '[/audio]'; } } + if (array_key_exists('type', $a) && stripos($a['type'], 'link') !== false) { + if (ActivityStreams::is_url($a['href']) && !strpos($item['body'], $a['href'])) { + $li = Url::get(z_root() . '/linkinfo?binurl=' . bin2hex($a['href'])); + if ($li['success'] && $li['body']) { + $item['body'] .= "\n" . $li['body']; + } else { + $item['body'] .= "\n\n" . $a['href']; + } + } + } + if (array_key_exists('type', $a) && stripos($a['type'], 'activity') !== false) { if (self::share_not_in_body($item['body'])) { $item = self::get_quote($a['href'], $item);