Merge branch 'develop' into rewrite/gravity-constants
This commit is contained in:
@@ -170,7 +170,7 @@ class Processor
|
||||
}
|
||||
|
||||
/**
|
||||
* Stire attachment data
|
||||
* Store attachment data
|
||||
*
|
||||
* @param array $activity
|
||||
* @param array $item
|
||||
@@ -187,7 +187,7 @@ class Processor
|
||||
}
|
||||
|
||||
/**
|
||||
* Store attachment data
|
||||
* Store question data
|
||||
*
|
||||
* @param array $activity
|
||||
* @param array $item
|
||||
@@ -552,7 +552,7 @@ class Processor
|
||||
Logger::notice('Fetching is done by worker.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]);
|
||||
Fetch::add($activity['reply-to-id']);
|
||||
$activity['recursion-depth'] = 0;
|
||||
$wid = Worker::add(PRIORITY_HIGH, 'FetchMissingActivity', $activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO);
|
||||
$wid = Worker::add(Worker::PRIORITY_HIGH, 'FetchMissingActivity', $activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO);
|
||||
Fetch::setWorkerId($activity['reply-to-id'], $wid);
|
||||
} else {
|
||||
Logger::debug('Activity will already be fetched via a worker.', ['url' => $activity['reply-to-id']]);
|
||||
@@ -1665,9 +1665,9 @@ class Processor
|
||||
}
|
||||
if (DI::config()->get('system', 'bulk_delivery')) {
|
||||
Post\Delivery::add($post['uri-id'], $uid, $inbox, $post['created'], Delivery::POST, [$cid]);
|
||||
Worker::add(PRIORITY_HIGH, 'APDelivery', '', 0, $inbox, 0);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'APDelivery', '', 0, $inbox, 0);
|
||||
} else {
|
||||
Worker::add(PRIORITY_HIGH, 'APDelivery', Delivery::POST, $post['id'], $inbox, $uid, [$cid], $post['uri-id']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'APDelivery', Delivery::POST, $post['id'], $inbox, $uid, [$cid], $post['uri-id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ class Receiver
|
||||
// We delay by 5 seconds to allow to accumulate all receivers
|
||||
$delayed = date(DateTimeFormat::MYSQL, time() + 5);
|
||||
Logger::debug('Initiate processing', ['id' => $object_data['entry-id'], 'uri' => $object_data['object_id']]);
|
||||
$wid = Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'ProcessQueue', $object_data['entry-id']);
|
||||
$wid = Worker::add(['priority' => Worker::PRIORITY_HIGH, 'delayed' => $delayed], 'ProcessQueue', $object_data['entry-id']);
|
||||
Queue::setWorkerId($object_data['entry-id'], $wid);
|
||||
} else {
|
||||
Logger::debug('Other queue entries need to be processed first.', ['id' => $object_data['entry-id']]);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace Friendica\Protocol\ActivityPub;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Cache\Enum\Duration;
|
||||
@@ -40,6 +41,7 @@ use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\Relay;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
@@ -415,7 +417,7 @@ class Transmitter
|
||||
{
|
||||
return [
|
||||
'type' => 'Service',
|
||||
'name' => FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'name' => App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'url' => DI::baseUrl()->get()
|
||||
];
|
||||
}
|
||||
@@ -1621,6 +1623,8 @@ class Transmitter
|
||||
|
||||
$permission_block = self::createPermissionBlockForItem($item, false);
|
||||
|
||||
$real_quote = false;
|
||||
|
||||
$body = $item['body'];
|
||||
|
||||
if ($type == 'Note') {
|
||||
@@ -1662,10 +1666,17 @@ class Transmitter
|
||||
|
||||
$body = BBCode::setMentionsToNicknames($body);
|
||||
|
||||
$shared = BBCode::fetchShareAttributes($body);
|
||||
if (!empty($shared['link']) && !empty($shared['guid']) && !empty($shared['comment'])) {
|
||||
$body = self::replaceSharedData($body);
|
||||
$data['quoteUrl'] = $shared['link'];
|
||||
if (!empty($item['quote-uri']) && Post::exists(['uri-id' => $item['quote-uri-id'], 'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN]])) {
|
||||
$real_quote = true;
|
||||
if (Diaspora::isReshare($body, false)) {
|
||||
$body = BBCode::replaceSharedData($body);
|
||||
} elseif (strpos($body, $item['quote-uri']) === false) {
|
||||
$body .= "\n♲ " . $item['quote-uri'];
|
||||
}
|
||||
$data['quoteUrl'] = $item['quote-uri'];
|
||||
} elseif (!empty($item['quote-uri']) && !Diaspora::isReshare($body, false)) {
|
||||
$body .= "\n" . DI::contentItem()->createSharedPostByUriId($item['quote-uri-id'], $item['uid'], true);
|
||||
$item['body'] = Item::improveSharedDataInBody($item, true);
|
||||
}
|
||||
|
||||
$data['content'] = BBCode::convertForUriId($item['uri-id'], $body, BBCode::ACTIVITYPUB);
|
||||
@@ -1678,9 +1689,11 @@ class Transmitter
|
||||
if (!empty($language)) {
|
||||
$richbody = BBCode::setMentionsToNicknames($item['body'] ?? '');
|
||||
|
||||
$shared = BBCode::fetchShareAttributes($richbody);
|
||||
if (!empty($shared['link']) && !empty($shared['guid']) && !empty($shared['comment'])) {
|
||||
$richbody = self::replaceSharedData($richbody);
|
||||
if ($real_quote) {
|
||||
$shared = BBCode::fetchShareAttributes($richbody);
|
||||
if (!empty($shared['link']) && !empty($shared['guid']) && !empty($shared['comment'])) {
|
||||
$richbody = BBCode::replaceSharedData($richbody);
|
||||
}
|
||||
}
|
||||
|
||||
$richbody = BBCode::removeAttachment($richbody);
|
||||
@@ -1710,22 +1723,6 @@ class Transmitter
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the share block with a link
|
||||
*
|
||||
* @param string $body
|
||||
* @return string
|
||||
*/
|
||||
private static function replaceSharedData(string $body): string
|
||||
{
|
||||
return BBCode::convertShare(
|
||||
$body,
|
||||
function (array $attributes) {
|
||||
return '♲ ' . $attributes['link'];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the language from the post, the user or the system.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user