Show statuses on the account page

Query an Account's Statuses and show them on the account page.
This commit is contained in:
St John Karp 2019-02-07 18:53:25 +00:00
parent 3d3f04ba90
commit 92689fe8c3
2 changed files with 27 additions and 2 deletions

View File

@ -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);

View File

@ -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>