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:
parent
5bc03f36d2
commit
92098a793e
15 changed files with 179 additions and 35 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue