added a very simple tag page

This commit is contained in:
Ghostie 2025-01-11 19:16:26 -05:00
parent 7e3b868a90
commit d2a2e466ef
7 changed files with 52 additions and 9 deletions

View File

@ -391,6 +391,10 @@ class APOutboxController extends Controller
} }
$create_activity = TypeActivity::craft_create ($actor, $note); $create_activity = TypeActivity::craft_create ($actor, $note);
$create_activity->to = $note->to;
$create_activity->cc = $note->cc;
$note->activity_id = $create_activity->id; $note->activity_id = $create_activity->id;
$note->save (); $note->save ();

View File

@ -58,7 +58,14 @@ class HomeController extends Controller
public function tag ($tag) public function tag ($tag)
{ {
dd ($tag); $tag_name = "#" . $tag;
$hashtag = Hashtag::where ("name", $tag_name)->first ();
if (!$hashtag)
return redirect ()->route ("browse");
$posts = $hashtag->get_notes ()->paginate (20);
return view ("posts.tag", compact ("hashtag", "posts"));
} }
public function search () public function search ()

View File

@ -16,7 +16,9 @@ class TypeActivity {
public static function craft_response (Activity $activity) public static function craft_response (Activity $activity)
{ {
$crafted_activity = [ $crafted_activity = [
"@context" => "https://www.w3.org/ns/activitystreams", "@context" => [
"https://www.w3.org/ns/activitystreams",
],
"id" => $activity->activity_id, "id" => $activity->activity_id,
"type" => $activity->type, "type" => $activity->type,
"actor" => $activity->actor, "actor" => $activity->actor,

View File

@ -209,14 +209,17 @@ class TypeActor {
// we need to save the model first // we need to save the model first
$actor->save (); $actor->save ();
ProfileAttachment::where ("actor_id", $actor->id)->delete (); if (isset ($request ["attachment"]))
foreach ($request ["attachment"] as $attachment)
{ {
$profile_attachment = ProfileAttachment::create ([ ProfileAttachment::where ("actor_id", $actor->id)->delete ();
"actor_id" => $actor->id, foreach ($request ["attachment"] as $attachment)
"name" => $attachment ["name"], {
"content" => $attachment ["value"] $profile_attachment = ProfileAttachment::create ([
]); "actor_id" => $actor->id,
"name" => $attachment ["name"],
"content" => $attachment ["value"]
]);
}
} }
$featured_items = TypeActor::actor_process_featured ($actor); $featured_items = TypeActor::actor_process_featured ($actor);

View File

@ -88,6 +88,9 @@ class TypeNote
"tag" => $request ["tag"] ?? null, "tag" => $request ["tag"] ?? null,
// TODO: This should change when I implement visibilities and private notes // TODO: This should change when I implement visibilities and private notes
"to" => [
"https://www.w3.org/ns/activitystreams#Public"
],
"cc" => [ "cc" => [
$actor->followers $actor->followers
] ]

View File

@ -0,0 +1,20 @@
@extends ("partials.layout")
@section ("title", "Posts Tagged with " . $hashtag->name)
@section ("content")
<div class="simple-container">
<h1>Showing posts with tag: {{ $hashtag->name }}</h1>
<br>
<table class="comments-table" cellspacing="0" cellpadding="3" bordercollor="#ffffff" border="1">
<tbody>
@foreach ($posts as $post)
<x-comment_block :post="$post" />
@endforeach
</tbody>
</table>
{{ $posts->links("pagination::default") }}
</div>
@endsection

View File

@ -16,6 +16,10 @@
</tr> </tr>
@foreach ($processed_notifications as $notification) @foreach ($processed_notifications as $notification)
@if (!$notification ['actor'] || !$notification ['object'])
@continue
@endif
<tr @if ($notification ['read_at'] == null) style="font-weight: bold" @endif> <tr @if ($notification ['read_at'] == null) style="font-weight: bold" @endif>
<td> <td>
@if ($notification ['type'] == 'Signup') @if ($notification ['type'] == 'Signup')