mirror of https://git.stjo.hn/planiverse
Exclude the logged-in user from reply mentions
When posting a reply, exclude the current user from the automatically populated list of mentions.
This commit is contained in:
parent
2bdea8f088
commit
157b9eed48
|
@ -39,10 +39,31 @@ class StatusController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Compile a list of accounts to include in the reply.
|
||||
$reply_mentions = [];
|
||||
if (session()->has('user'))
|
||||
{
|
||||
// Include the original poster, if not the current user.
|
||||
if ($status['account']['acct'] !== session('user')->user['acct'])
|
||||
{
|
||||
array_push($reply_mentions, '@' . $status['account']['acct']);
|
||||
}
|
||||
|
||||
// Include all mentions, excluding the current user.
|
||||
foreach ($status['mentions'] as $mention)
|
||||
{
|
||||
if ($mention['acct'] !== session('user')->user['acct'])
|
||||
{
|
||||
array_push($reply_mentions, '@' . $mention['acct']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$vars = [
|
||||
'status' => $status,
|
||||
'mastodon_domain' => explode('//', env('MASTODON_DOMAIN'))[1],
|
||||
'logged_in' => session()->has('user')
|
||||
'logged_in' => session()->has('user'),
|
||||
'reply_mentions' => implode(' ', $reply_mentions)
|
||||
];
|
||||
|
||||
return view('show_status', $vars);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
placeholder="Spoiler/Warning"
|
||||
value="{{ $status['spoiler_text'] }}"
|
||||
/>
|
||||
<textarea rows="4" name="status" placeholder="Reply" required autofocus>{{ '@' . $status['account']['acct'] }} @foreach ($status['mentions'] as $mention){{ '@' . $mention['acct'] }} @endforeach</textarea>
|
||||
<textarea rows="4" name="status" placeholder="Reply" required autofocus>{{ $reply_mentions }} </textarea>
|
||||
<select name="visibility">
|
||||
<option value="public" @if ($status['visibility'] === 'public') selected @endif>Public</option>
|
||||
<option value="unlisted" @if ($status['visibility'] === 'unlisted') selected @endif>Unlisted</option>
|
||||
|
|
Loading…
Reference in New Issue