commit 92689fe8c3b1038855cae69f324ceddb1c5ac2ae
parent 3d3f04ba90f6c6202213efdb53be2548c3518c11
Author: St John Karp <stjohn@fuzzjunket.com>
Date: Thu, 7 Feb 2019 18:53:25 +0000
Show statuses on the account page
Query an Account's Statuses and show them on the account page.
Diffstat:
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
@@ -6,6 +6,9 @@ use App\Http\Controllers\Controller;
use Mastodon;
use Illuminate\Http\Request;
+use App\Helpers\Links;
+use App\Helpers\PaginationParameters;
+
/**
* Controller for Account functions.
*/
@@ -49,10 +52,20 @@ class AccountController extends Controller
$relationship = $relationships[0];
}
+ # Get the Account's Statuses from the API.
+ $statuses = Mastodon::domain(env('MASTODON_DOMAIN'))
+ ->token($user->token)
+ ->get('/accounts/' . $account_id . '/statuses');
+
$vars = [
'account' => $account,
'mastodon_domain' => explode('//', env('MASTODON_DOMAIN'))[1],
- 'relationship' => $relationship
+ 'relationship' => $relationship,
+ 'statuses' => $statuses,
+ 'links' => new Links(
+ Mastodon::getResponse()->getHeader('link'),
+ 'public'
+ )
];
return view('account', $vars);
diff --git a/resources/views/account.blade.php b/resources/views/account.blade.php
@@ -39,7 +39,19 @@
Follow
</a>
@endif
- </div>
+ </div>
+
+ <h2>Statuses</h2>
+
+ <ul>
+ @foreach ($statuses as $status)
+ @component('status', ['status' => $status])
+ @endcomponent
+ @endforeach
+ </ul>
+
+ @component('pagination', ['links' => $links])
+ @endcomponent
</div>
</body>
</html>