mirror of https://git.stjo.hn/planiverse
Implement reply functionality
Created a new status view that shows a single status and permits replies if you're logged in.
This commit is contained in:
parent
be9e3c3603
commit
7cd1d14d8a
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Mastodon;
|
||||
use GuzzleHttp\Psr7;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class StatusController extends Controller
|
||||
{
|
||||
public function show_status(Request $request, string $status_id)
|
||||
{
|
||||
$status = Mastodon::domain(env('MASTODON_DOMAIN'))
|
||||
->get('/statuses/' . $status_id);
|
||||
|
||||
$vars = [
|
||||
'status' => $status,
|
||||
'mastodon_domain' => explode('//', env('MASTODON_DOMAIN'))[1],
|
||||
'logged_in' => session()->has('user')
|
||||
];
|
||||
|
||||
return view('show_status', $vars);
|
||||
}
|
||||
}
|
|
@ -54,6 +54,10 @@ div.actions span {
|
|||
margin-right: 1em;
|
||||
}
|
||||
|
||||
div.actions a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
time {
|
||||
font-size: smaller;
|
||||
margin-left: 1em;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>{{ $mastodon_domain }} | Status</title>
|
||||
|
||||
<link rel="stylesheet" href="/css/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{ $mastodon_domain }} | Status</h1>
|
||||
|
||||
@component('status', ['status' => $status])
|
||||
@endcomponent
|
||||
|
||||
@if ($logged_in)
|
||||
<form method="post" action="/timeline/home">
|
||||
<input type="text" name="spoiler_text" placeholder="Spoiler/Warning" />
|
||||
<textarea rows="4" name="status" placeholder="Reply" required autofocus></textarea>
|
||||
<input type="submit" value="Post" />
|
||||
<input type="hidden" name="in_reply_to_id" value="{{ $status['id'] }}" />
|
||||
{{ csrf_field() }}
|
||||
</form>
|
||||
@endif
|
||||
</body>
|
||||
</html>
|
|
@ -43,7 +43,7 @@
|
|||
<div class="actions">
|
||||
<!-- Reply -->
|
||||
<span>
|
||||
↵
|
||||
<a href="/status/{{ $status['id'] }}">↵</a>
|
||||
</span>
|
||||
|
||||
<!-- Reblog -->
|
||||
|
|
|
@ -30,6 +30,8 @@ Route::get('/timeline/home', 'TimelineController@home_timeline')
|
|||
|
||||
Route::post('/timeline/home', 'TimelineController@post_status');
|
||||
|
||||
Route::get('/status/{status_id}', 'StatusController@show_status');
|
||||
|
||||
Route::get('/login', 'LoginController@login')
|
||||
->name('login');
|
||||
|
||||
|
|
Loading…
Reference in New Issue