mirror of
https://github.com/friendica/friendica
synced 2024-11-09 17:02:54 +00:00
Fix: Posts with attached links work again
This commit is contained in:
parent
35beffc8a8
commit
c088bab141
1 changed files with 41 additions and 27 deletions
|
@ -262,8 +262,10 @@ class Transmitter
|
|||
|
||||
$owner_cid = Contact::getIdForURL($owner['url'], 0, false);
|
||||
|
||||
$condition = ["`uri-id` IN (SELECT `uri-id` FROM `collection-view` WHERE `cid` = ? AND `type` = ?)",
|
||||
$owner_cid, Post\Collection::FEATURED];
|
||||
$condition = [
|
||||
"`uri-id` IN (SELECT `uri-id` FROM `collection-view` WHERE `cid` = ? AND `type` = ?)",
|
||||
$owner_cid, Post\Collection::FEATURED
|
||||
];
|
||||
|
||||
$condition = DBA::mergeConditions($condition, [
|
||||
'uid' => $owner['uid'],
|
||||
|
@ -377,8 +379,10 @@ class Transmitter
|
|||
$data['name'] = $full ? $owner['name'] : $owner['nick'];
|
||||
|
||||
if ($full && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
|
||||
$data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
|
||||
'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']];
|
||||
$data['vcard:hasAddress'] = [
|
||||
'@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
|
||||
'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']
|
||||
];
|
||||
}
|
||||
|
||||
if ($full && !empty($owner['about'])) {
|
||||
|
@ -399,9 +403,11 @@ class Transmitter
|
|||
$data['url'] = $owner['url'];
|
||||
$data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
|
||||
$data['discoverable'] = (bool)$owner['net-publish'] && $full;
|
||||
$data['publicKey'] = ['id' => $owner['url'] . '#main-key',
|
||||
$data['publicKey'] = [
|
||||
'id' => $owner['url'] . '#main-key',
|
||||
'owner' => $owner['url'],
|
||||
'publicKeyPem' => $owner['pubkey']];
|
||||
'publicKeyPem' => $owner['pubkey']
|
||||
];
|
||||
$data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
|
||||
if ($full && $uid != 0) {
|
||||
$data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrl($owner)];
|
||||
|
@ -1655,10 +1661,12 @@ class Transmitter
|
|||
}
|
||||
$urls[] = $attachment['url'];
|
||||
|
||||
$attach = ['type' => 'Document',
|
||||
$attach = [
|
||||
'type' => 'Document',
|
||||
'mediaType' => $attachment['mimetype'],
|
||||
'url' => $attachment['url'],
|
||||
'name' => $attachment['description']];
|
||||
'name' => $attachment['description']
|
||||
];
|
||||
|
||||
if (!empty($attachment['height'])) {
|
||||
$attach['height'] = $attachment['height'];
|
||||
|
@ -1790,7 +1798,6 @@ class Transmitter
|
|||
|
||||
$title = $item['title'];
|
||||
$summary = $item['content-warning'] ?: BBCode::toPlaintext(BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB));
|
||||
$source = $item['body'];
|
||||
|
||||
if ($item['event-type'] == 'event') {
|
||||
$type = 'Event';
|
||||
|
@ -1805,9 +1812,8 @@ class Transmitter
|
|||
if (!$summary) {
|
||||
$summary = $title;
|
||||
} else {
|
||||
$item['raw-body'] = '[b]' . $title . "[/b]\n\n" . $item['raw-body'];
|
||||
$item['body'] = '[b]' . $title . "[/b]\n\n" . $item['body'];
|
||||
$source = '[h4]' . $title . "[/h4]\n" . $source;
|
||||
$item['raw-body'] = '[h4][b]' . $title . "[/b][/h4]\n\n" . $item['raw-body'];
|
||||
$item['body'] = '[h4][b]' . $title . "[/b][/h4]\n\n" . $item['body'];
|
||||
}
|
||||
$title = '';
|
||||
break;
|
||||
|
@ -1815,7 +1821,6 @@ class Transmitter
|
|||
$type = 'Note';
|
||||
$item['raw-body'] = '[b]' . $title . "[/b]\n\n" . $item['raw-body'];
|
||||
$item['body'] = '[b]' . $title . "[/b]\n\n" . $item['body'];
|
||||
$source = '[h4]' . $title . "[/h4]\n" . $source;
|
||||
$title = '';
|
||||
break;
|
||||
}
|
||||
|
@ -1954,7 +1959,9 @@ class Transmitter
|
|||
}
|
||||
|
||||
if (!empty($item['quote-uri-id']) && ($item['quote-uri-id'] != $item['uri-id'])) {
|
||||
$source = DI::contentItem()->addSharedPost($item, $source);
|
||||
$source = DI::contentItem()->addSharedPost($item, $item['body']);
|
||||
} else {
|
||||
$source = $item['body'];
|
||||
}
|
||||
|
||||
$data['source'] = ['content' => $source, 'mediaType' => "text/bbcode"];
|
||||
|
@ -2207,7 +2214,8 @@ class Transmitter
|
|||
return false;
|
||||
}
|
||||
|
||||
$data = ['@context' => ActivityPub::CONTEXT,
|
||||
$data = [
|
||||
'@context' => ActivityPub::CONTEXT,
|
||||
'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
|
||||
'type' => 'Delete',
|
||||
'actor' => $owner['url'],
|
||||
|
@ -2215,7 +2223,8 @@ class Transmitter
|
|||
'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||
'instrument' => self::getService(),
|
||||
'to' => [ActivityPub::PUBLIC_COLLECTION],
|
||||
'cc' => []];
|
||||
'cc' => []
|
||||
];
|
||||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
|
@ -2237,7 +2246,8 @@ class Transmitter
|
|||
{
|
||||
$profile = APContact::getByURL($owner['url']);
|
||||
|
||||
$data = ['@context' => ActivityPub::CONTEXT,
|
||||
$data = [
|
||||
'@context' => ActivityPub::CONTEXT,
|
||||
'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
|
||||
'type' => 'Update',
|
||||
'actor' => $owner['url'],
|
||||
|
@ -2245,7 +2255,8 @@ class Transmitter
|
|||
'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||
'instrument' => self::getService(),
|
||||
'to' => [$profile['followers']],
|
||||
'cc' => []];
|
||||
'cc' => []
|
||||
];
|
||||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
|
@ -2330,8 +2341,10 @@ class Transmitter
|
|||
$uid = $admin['uid'];
|
||||
}
|
||||
|
||||
$condition = ['verb' => Activity::FOLLOW, 'uid' => 0, 'parent-uri' => $object,
|
||||
'author-id' => Contact::getPublicIdByUserId($uid)];
|
||||
$condition = [
|
||||
'verb' => Activity::FOLLOW, 'uid' => 0, 'parent-uri' => $object,
|
||||
'author-id' => Contact::getPublicIdByUserId($uid)
|
||||
];
|
||||
if (Post::exists($condition)) {
|
||||
Logger::info('Follow for ' . $object . ' for user ' . $uid . ' does already exist.');
|
||||
return false;
|
||||
|
@ -2500,7 +2513,8 @@ class Transmitter
|
|||
|
||||
foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
|
||||
$profile = Contact::getByURL($tag['url'], false, ['addr', 'contact-type', 'nick']);
|
||||
if (!empty($profile['addr'])
|
||||
if (
|
||||
!empty($profile['addr'])
|
||||
&& $profile['contact-type'] != Contact::TYPE_COMMUNITY
|
||||
&& !strstr($body, $profile['addr'])
|
||||
&& !strstr($body, $tag['url'])
|
||||
|
|
Loading…
Reference in a new issue