forked from GNUsocial/gnu-social
[CONTROLLER][PLUGIN][Reply] Move reply controller to it's plugin
This commit is contained in:
parent
73981030fa
commit
36613a826d
@ -38,6 +38,7 @@ use App\Util\Common;
|
|||||||
use App\Util\Exception\ClientException;
|
use App\Util\Exception\ClientException;
|
||||||
use App\Util\Exception\InvalidFormException;
|
use App\Util\Exception\InvalidFormException;
|
||||||
use App\Util\Exception\NoSuchNoteException;
|
use App\Util\Exception\NoSuchNoteException;
|
||||||
|
use App\Util\Exception\NotImplementedException;
|
||||||
use App\Util\Exception\RedirectException;
|
use App\Util\Exception\RedirectException;
|
||||||
use App\Util\Form\FormFields;
|
use App\Util\Form\FormFields;
|
||||||
use Component\Posting\Posting;
|
use Component\Posting\Posting;
|
||||||
@ -138,4 +139,23 @@ class Reply extends Controller
|
|||||||
'add_reply' => $form->createView(),
|
'add_reply' => $form->createView(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function replies(Request $request)
|
||||||
|
{
|
||||||
|
// TODO replies
|
||||||
|
throw new NotImplementedException;
|
||||||
|
$actor_id = Common::ensureLoggedIn()->getId();
|
||||||
|
$notes = DB::dql('select n from App\Entity\Note n '
|
||||||
|
. 'where n.reply_to is not null and n.actor_id = :id '
|
||||||
|
. 'order by n.created DESC', ['id' => $actor_id], );
|
||||||
|
|
||||||
|
$notes_out = null;
|
||||||
|
Event::handle('FormatNoteList', [$notes, &$notes_out]);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'_template' => 'feeds/feed.html.twig',
|
||||||
|
'notes' => $notes_out,
|
||||||
|
'page_title' => 'Replies feed',
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,10 @@ class Reply extends NoteHandlerPlugin
|
|||||||
public function onAddRoute($r)
|
public function onAddRoute($r)
|
||||||
{
|
{
|
||||||
$r->connect('reply_add', '/object/note/{id<\d+>}/reply', [ReplyController::class, 'replyAddNote']);
|
$r->connect('reply_add', '/object/note/{id<\d+>}/reply', [ReplyController::class, 'replyAddNote']);
|
||||||
|
$r->connect('replies', '/@{nickname<' . Nickname::DISPLAY_FMT . '>}/replies', [ReplyController::class, 'replies']);
|
||||||
|
|
||||||
|
return Event::next;
|
||||||
|
}
|
||||||
|
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user