Merge remote-tracking branch 'upstream/develop' into nodeinfo

This commit is contained in:
Michael 2019-11-28 16:10:18 +00:00
commit e1f9dd5bb5
2 changed files with 11 additions and 7 deletions

View file

@ -93,22 +93,21 @@ class Processor
/** /**
* Add attachment data to the item array * Add attachment data to the item array
* *
* @param array $attachments * @param array $activity
* @param array $item * @param array $item
* @param boolean $no_images
* *
* @return array array * @return array array
*/ */
private static function constructAttachList($attachments, $item, $no_images) private static function constructAttachList($activity, $item)
{ {
if (empty($attachments)) { if (empty($activity['attachments'])) {
return $item; return $item;
} }
foreach ($attachments as $attach) { foreach ($activity['attachments'] as $attach) {
$filetype = strtolower(substr($attach['mediaType'], 0, strpos($attach['mediaType'], '/'))); $filetype = strtolower(substr($attach['mediaType'], 0, strpos($attach['mediaType'], '/')));
if ($filetype == 'image') { if ($filetype == 'image') {
if ($no_images) { if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
continue; continue;
} }
@ -407,7 +406,7 @@ class Processor
$item['plink'] = $activity['alternate-url'] ?? $item['uri']; $item['plink'] = $activity['alternate-url'] ?? $item['uri'];
$item = self::constructAttachList($activity['attachments'], $item, !empty($activity['source'])); $item = self::constructAttachList($activity, $item);
$stored = false; $stored = false;

View file

@ -15,6 +15,7 @@ use Friendica\Model;
use Friendica\Protocol\DFRN; use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
use Friendica\Protocol\Activity;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -500,6 +501,10 @@ class Delivery extends BaseObject
return; return;
} }
if ($target_item['verb'] != Activity::POST) {
return;
}
if (!empty($thr_parent['object'])) { if (!empty($thr_parent['object'])) {
$data = json_decode($thr_parent['object'], true); $data = json_decode($thr_parent['object'], true);
if (!empty($data['reply_to'])) { if (!empty($data['reply_to'])) {