obtaining actors from mentions and more pagination
This commit is contained in:
parent
bffa72125a
commit
324b8e849f
@ -10,6 +10,8 @@ use App\Models\Actor;
|
||||
use App\Models\Note;
|
||||
use App\Models\Hashtag;
|
||||
|
||||
use App\Helpers\PaginationHelper;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
@ -127,6 +129,9 @@ class HomeController extends Controller
|
||||
$sent_requests[] = $actor;
|
||||
}
|
||||
|
||||
$received_requests = PaginationHelper::paginate (collect ($received_requests), 20, "received");
|
||||
$sent_requests = PaginationHelper::paginate (collect ($sent_requests), 20, "sent");
|
||||
|
||||
return view ("users.requests", compact ("user", "received_requests", "sent_requests"));
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,9 @@ class TypeActor {
|
||||
$instance->save ();
|
||||
}
|
||||
|
||||
// we need to save the model first
|
||||
$actor->save ();
|
||||
|
||||
ProfileAttachment::where ("actor_id", $actor->id)->delete ();
|
||||
foreach ($request ["attachment"] as $attachment)
|
||||
{
|
||||
@ -245,7 +248,6 @@ class TypeActor {
|
||||
$actor = new Actor ();
|
||||
TypeActor::update_from_request ($actor, $request);
|
||||
|
||||
$actor->save ();
|
||||
return $actor;
|
||||
}
|
||||
|
||||
|
@ -182,20 +182,26 @@ class TypeNote
|
||||
|
||||
case "Mention":
|
||||
$mention_name = $tag["name"];
|
||||
$exploded_name = explode ("@", $mention_name);
|
||||
$mention_actor = null;
|
||||
|
||||
$actor_exists = Actor::where ("local_actor_id", $mention_name)->first ();
|
||||
if (!$actor_exists)
|
||||
$actor_exists = null;
|
||||
Log::info (json_encode ($exploded_name));
|
||||
|
||||
if (count ($exploded_name) == 2)
|
||||
{
|
||||
// let's check if maybe it's local
|
||||
$processed_name = explode ("@", $mention_name);
|
||||
if (count ($processed_name) < 2)
|
||||
continue;
|
||||
|
||||
$actor_exists = Actor::where ("preferredUsername", $processed_name [1])->first ();
|
||||
$actor_exists = Actor::where ("preferredUsername", $exploded_name [1])->first ();
|
||||
if (!$actor_exists)
|
||||
continue;
|
||||
}
|
||||
else if (count ($exploded_name) == 3)
|
||||
{
|
||||
// maybe it's remote
|
||||
$actor_exists = TypeActor::actor_exists_or_obtain_from_handle($exploded_name [1], $exploded_name [2]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
$mention = NoteMention::create ([
|
||||
"note_id" => $note->id,
|
||||
|
@ -70,7 +70,7 @@
|
||||
{!! $note->content !!}
|
||||
|
||||
@foreach ($note->attachments as $attachment)
|
||||
<img loading="lazy" src="{{ $attachment->url }}" width="250">
|
||||
<img loading="lazy" src="{{ $attachment->url }}" width="250" class="expandable">
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
<br>
|
||||
<p>
|
||||
<b>
|
||||
<span class="count">{{ count ($user->received_requests ()) }}</span>
|
||||
<span class="count">{{ $received_requests->total () }}</span>
|
||||
Open Friend Requests
|
||||
</b>
|
||||
|
||||
@ -53,12 +53,14 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ $received_requests->withQueryString ()->links("pagination::default") }}
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<p>
|
||||
<b>
|
||||
<span class="count">{{ count ($user->sent_requests ()) }}</span>
|
||||
<span class="count">{{ $sent_requests->total () }}</span>
|
||||
Pending Friend Requests
|
||||
</b>
|
||||
<br>
|
||||
@ -92,6 +94,8 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ $sent_requests->withQueryString ()->links("pagination::default") }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user