1
0
Fork 0

Merge pull request #13018 from annando/share-federated

Only share from federated posts
This commit is contained in:
Hypolite Petovan 2023-04-22 08:34:53 -04:00 committed by GitHub
commit 9dc5557fb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -68,7 +68,7 @@ class Share extends \Friendica\BaseModule
$shared = $this->contentItem->getSharedPost($item, ['uri']); $shared = $this->contentItem->getSharedPost($item, ['uri']);
if ($shared && empty($shared['comment'])) { if ($shared && empty($shared['comment'])) {
$content = '[share]' . $shared['post']['uri'] . '[/share]'; $content = '[share]' . $shared['post']['uri'] . '[/share]';
} elseif ($item['network'] == Protocol::FEED) { } elseif (!empty($item['plink']) && !in_array($item['network'], Protocol::FEDERATED)) {
$content = '[attachment]' . $item['plink'] . '[/attachment]'; $content = '[attachment]' . $item['plink'] . '[/attachment]';
} else { } else {
$content = '[share]' . $item['uri'] . '[/share]'; $content = '[share]' . $item['uri'] . '[/share]';

View file

@ -205,8 +205,9 @@ class Post
$lock = ($item['private'] == Item::PRIVATE) ? $privacy : false; $lock = ($item['private'] == Item::PRIVATE) ? $privacy : false;
$connector = !in_array($item['network'], Protocol::NATIVE_SUPPORT) ? DI::l10n()->t('Connector Message') : false; $connector = !in_array($item['network'], Protocol::NATIVE_SUPPORT) ? DI::l10n()->t('Connector Message') : false;
$shareable = in_array($conv->getProfileOwner(), [0, DI::userSession()->getLocalUserId()]) && $item['private'] != Item::PRIVATE; $shareable = in_array($conv->getProfileOwner(), [0, DI::userSession()->getLocalUserId()]) && $item['private'] != Item::PRIVATE;
$announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER]); $announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER, Protocol::TUMBLR]);
$commentable = ($item['network'] != Protocol::TUMBLR);
// On Diaspora only toplevel posts can be reshared // On Diaspora only toplevel posts can be reshared
if ($announceable && ($item['network'] == Protocol::DIASPORA) && ($item['gravity'] != Item::GRAVITY_PARENT)) { if ($announceable && ($item['network'] == Protocol::DIASPORA) && ($item['gravity'] != Item::GRAVITY_PARENT)) {
@ -392,7 +393,11 @@ class Post
} }
} }
$comment_html = $this->getCommentBox($indent); if ($commentable) {
$comment_html = $this->getCommentBox($indent);
} else {
$comment_html = '';
}
if (strcmp(DateTimeFormat::utc($item['created']), DateTimeFormat::utc('now - 12 hours')) > 0) { if (strcmp(DateTimeFormat::utc($item['created']), DateTimeFormat::utc('now - 12 hours')) > 0) {
$shiny = 'shiny'; $shiny = 'shiny';