mirror of https://git.stjo.hn/planiverse
Implement reblogging
Implemented ability to reblog a status.
This commit is contained in:
parent
d95406c407
commit
d2c1874f0b
|
@ -13,7 +13,7 @@ class StatusController extends Controller
|
|||
{
|
||||
// The user has a session and may be here to favourite/unfavourite
|
||||
// a status.
|
||||
if (session()->has('user'))
|
||||
if (session()->has('user') && $request->has('action'))
|
||||
{
|
||||
$user = session('user');
|
||||
if ($request->action === 'favourite')
|
||||
|
@ -28,6 +28,18 @@ class StatusController extends Controller
|
|||
->token($user->token)
|
||||
->post('/statuses/' . $status_id . '/unfavourite');
|
||||
}
|
||||
elseif ($request->action === 'reblog')
|
||||
{
|
||||
$status = Mastodon::domain(env('MASTODON_DOMAIN'))
|
||||
->token($user->token)
|
||||
->post('/statuses/' . $status_id . '/reblog');
|
||||
}
|
||||
elseif ($request->action === 'unreblog')
|
||||
{
|
||||
$status = Mastodon::domain(env('MASTODON_DOMAIN'))
|
||||
->token($user->token)
|
||||
->post('/statuses/' . $status_id . '/unreblog');
|
||||
}
|
||||
}
|
||||
|
||||
// If the status hasn't been returned from performing an action on it,
|
||||
|
|
|
@ -67,6 +67,10 @@ div.actions span.favourited a {
|
|||
color: goldenrod;
|
||||
}
|
||||
|
||||
div.actions span.reblogged a {
|
||||
color: green;
|
||||
}
|
||||
|
||||
time {
|
||||
font-size: smaller;
|
||||
margin-left: 1em;
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
<body>
|
||||
<h1>{{ $mastodon_domain }} | Status</h1>
|
||||
|
||||
@component('navigation')
|
||||
@endcomponent
|
||||
|
||||
@component('status', ['status' => $status])
|
||||
@endcomponent
|
||||
|
||||
|
|
|
@ -38,13 +38,22 @@
|
|||
|
||||
<!-- Reblog -->
|
||||
<span>
|
||||
⇄ {{ $status['reblogs_count'] }}
|
||||
@if ($status['reblogged'])
|
||||
<span class="reblogged">
|
||||
<a href="/status/{{ $status['id'] }}?action=unreblog">⇄</a>
|
||||
</span>
|
||||
@else
|
||||
<a href="/status/{{ $status['id'] }}?action=reblog">⇄</a>
|
||||
@endif
|
||||
{{ $status['reblogs_count'] }}
|
||||
</span>
|
||||
|
||||
<!-- Favourite -->
|
||||
<span>
|
||||
@if ($status['favourited'])
|
||||
<span class="favourited"><a href="/status/{{ $status['id'] }}?action=unfavourite">★</a></span>
|
||||
<span class="favourited">
|
||||
<a href="/status/{{ $status['id'] }}?action=unfavourite">★</a>
|
||||
</span>
|
||||
@else
|
||||
<a href="/status/{{ $status['id'] }}?action=favourite">☆</a>
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue