feat: Add webmention counts and icons for replies, likes, and reposts.

- Add new SVG icons for the "reply", "like", and "repost" actions
- Update webmention info display in note template to include counts and icons for replies, likes, and reposts
- Add webmention counts to FrontPageController.php and modify queries in NotesController.php
- Modify WebMentionsTableSeeder.php to change URLs, commentable ID, and add new WebMentions
This commit is contained in:
Jonny Barnes 2023-11-25 16:08:07 +00:00
parent 5bc03f36d2
commit 92098a793e
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
15 changed files with 179 additions and 35 deletions

View file

@ -26,8 +26,14 @@ class NotesController extends Controller
{
$notes = Note::latest()
->with('place', 'media', 'client')
->withCount(['webmentions As replies' => function ($query) {
->withCount(['webmentions AS replies' => function ($query) {
$query->where('type', 'in-reply-to');
}])
->withCount(['webmentions AS likes' => function ($query) {
$query->where('type', 'like-of');
}])
->withCount(['webmentions AS reposts' => function ($query) {
$query->where('type', 'repost-of');
}])->paginate(10);
return view('notes.index', compact('notes'));
@ -39,7 +45,16 @@ class NotesController extends Controller
public function show(string $urlId): View|JsonResponse|Response
{
try {
$note = Note::nb60($urlId)->with('webmentions')->firstOrFail();
$note = Note::nb60($urlId)->with('place', 'media', 'client')
->withCount(['webmentions AS replies' => function ($query) {
$query->where('type', 'in-reply-to');
}])
->withCount(['webmentions AS likes' => function ($query) {
$query->where('type', 'like-of');
}])
->withCount(['webmentions AS reposts' => function ($query) {
$query->where('type', 'repost-of');
}])->firstOrFail();
} catch (ModelNotFoundException $exception) {
abort(404);
}