return true;
}
+ $attributed_to = JsonLD::fetchElement($activity['as:object'], 'as:attributedTo', '@id');
+ $authorid = Contact::getIdForURL($attributed_to);
+
$body = HTML::toBBCode(JsonLD::fetchElement($activity['as:object'], 'as:content', '@value'));
$messageTags = [];
}
}
- return Relay::isSolicitedPost($messageTags, $body, $id, Protocol::ACTIVITYPUB);
+ return Relay::isSolicitedPost($messageTags, $body, $authorid, $id, Protocol::ACTIVITYPUB);
}
/**
$taglist = Tag::getByURIId($item['uri-id'], [Tag::HASHTAG]);
$tags = array_column($taglist, 'name');
- return Relay::isSolicitedPost($tags, $item['body'], $item['uri'], Protocol::DFRN);
+ return Relay::isSolicitedPost($tags, $item['body'], $item['author-id'], $item['uri'], Protocol::DFRN);
}
/**
$taglist = Tag::getByURIId($uriid, [Tag::HASHTAG]);
$tags = array_column($taglist, 'name');
- return Relay::isSolicitedPost($tags, $body, $url, Protocol::DIASPORA);
+ return Relay::isSolicitedPost($tags, $body, $contact['id'], $url, Protocol::DIASPORA);
}
/**
use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger;
use Friendica\DI;
+use Friendica\Model\Contact;
use Friendica\Model\Search;
/**
*
* @param array $tags
* @param string $body
+ * @param int $authorid
* @param string $url
* @return boolean "true" is the post is wanted by the system
*/
- public static function isSolicitedPost(array $tags, string $body, string $url, string $network = '')
+ public static function isSolicitedPost(array $tags, string $body, int $authorid, string $url, string $network = '')
{
$config = DI::config();
return false;
}
+ if (Contact::isBlocked($authorid)) {
+ Logger::info('Author is blocked - rejected', ['author' => $authorid, 'network' => $network, 'url' => $url]);
+ return false;
+ }
+
+ if (Contact::isHidden($authorid)) {
+ Logger::info('Author is hidden - rejected', ['author' => $authorid, 'network' => $network, 'url' => $url]);
+ return false;
+ }
+
$systemTags = [];
$userTags = [];
$denyTags = [];