Commit 1d6e0eb6 authored by swentel's avatar swentel

Issue #3174743: hello pixelfed

parent e055c942
......@@ -7,8 +7,9 @@ come.
The module has been tested with the following federated platforms:
- Mastodon: follow/accept, post notes, reply
- Mastodon: follow/accept, post notes (with image), reply
- Pleroma: follow/accept, post notes, reply
- Pixelfed: follow/accept, reply
Open an issue if you have successfully interacted with another platform!
......
......@@ -34,8 +34,9 @@ class NodeController extends BaseController {
if ($actor && $activity) {
$build = $activity->buildActivity();
$build['@context'] = ActivityPubOutboxClientInterface::STREAMS_CONTEXT;
$response = new JsonResponse($build, 200);
$object = $build['object'];
$object['@context'] = ActivityPubOutboxClientInterface::STREAMS_CONTEXT;
$response = new JsonResponse($object, 200);
$response->headers->set('Content-Type', 'application/activity+json');
return $response;
}
......
......@@ -105,7 +105,7 @@ class DynamicTypes extends TypePluginBase {
* {@inheritdoc}
*/
public function build(ActivityPubActivityInterface $activity, EntityInterface $entity = NULL) {
$attributes = [
$object = [
'type' => $this->getConfiguration()['object'],
'id' => $this->renderUrl($entity),
'attributedTo' => $activity->getActor(),
......@@ -115,7 +115,7 @@ class DynamicTypes extends TypePluginBase {
if (!empty($mapping['field_name'])) {
if ($entity->hasField($mapping['field_name']) && ($value = $entity->get($mapping['field_name'])->getValue())) {
if ($v = $this->getValue($mapping['property'], $value)) {
$attributes[$mapping['property']] = $v;
$object[$mapping['property']] = $v;
}
}
}
......@@ -125,18 +125,17 @@ class DynamicTypes extends TypePluginBase {
if (!empty($activity->getObject())) {
$to[] = $activity->getObject();
}
$attributes['to'] = $to;
$object['to'] = $to;
$type = Type::create($attributes);
$activity_attributes = [
$activity = [
'type' => $this->getConfiguration()['activity'],
'id' => $this->renderUrl($activity),
'actor' => $activity->getActor(),
'to' => $to,
'object' => $type->toArray()
'object' => $object
];
$activity = Type::create($activity_attributes);
return $activity->toArray();
return $activity;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment