[PLUGIN][ActivityPub][Inbox] Accept Follow Activity

Improve how Core Activity is handled in general
This commit is contained in:
2022-01-02 20:37:15 +00:00
parent afb7ae0f75
commit def5f36c25
18 changed files with 336 additions and 140 deletions

View File

@@ -28,10 +28,10 @@ use App\Core\Event;
use App\Core\Modules\Component;
use App\Core\Router\RouteLoader;
use App\Entity\Actor;
use App\Entity\Subscription;
use App\Util\Formatting;
use Component\Feed\Controller as C;
use Component\Search\Util\Parser;
use Component\Subscription\Entity\Subscription;
use Doctrine\Common\Collections\ExpressionBuilder;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
@@ -80,9 +80,9 @@ class Feed extends Component
return ['notes' => $notes ?? null, 'actors' => $actors ?? null];
}
public function onSearchQueryAddJoins(QueryBuilder &$note_qb, QueryBuilder &$actor_qb)
public function onSearchQueryAddJoins(QueryBuilder &$note_qb, QueryBuilder &$actor_qb): bool
{
$note_qb->leftJoin(Subscription::class, 'subscription', Expr\Join::WITH, 'note.actor_id = subscription.subscribed')
$note_qb->leftJoin(Subscription::class, 'subscription', Expr\Join::WITH, 'note.actor_id = subscription.subscribed_id')
->leftJoin(Actor::class, 'note_actor', Expr\Join::WITH, 'note.actor_id = note_actor.id');
return Event::next;
}
@@ -117,7 +117,7 @@ class Feed extends Component
break;
case 'note-from':
case 'notes-from':
$subscribed_expr = $eb->eq('subscription.subscriber', $actor->getId());
$subscribed_expr = $eb->eq('subscription.subscriber_id', $actor->getId());
$type_consts = [];
if ($term[1] === 'subscribed') {
$type_consts = null;

View File

@@ -9,18 +9,16 @@
{% endblock stylesheets %}
{% block body %}
{% if notes is defined and notes is not empty %}
<header class="feed-header">
{% if page_title is defined %}
<h1>{{ page_title | trans }}</h1>
{% endif %}
<nav class="feed-actions">
{% for block in handle_event('AddFeedActions', app.request) %}
{{ block | raw }}
{% endfor %}
</nav>
</header>
<header class="feed-header">
{% if page_title is defined %}
<h1>{{ page_title | trans }}</h1>
{% endif %}
<nav class="feed-actions">
{% for block in handle_event('AddFeedActions', app.request) %}
{{ block | raw }}
{% endfor %}
</nav>
</header>
{# Backwards compatibility with hAtom 0.1 #}
<main class="feed" tabindex="0" role="feed">