1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 17:36:38 +02:00

Allow admins to see last online text (#1540)

* Allow admins to see last online text

* Use viewLastSeenAt permission

* Move permission to UserSerializer, removed from ForumSerializer

* Remove extra comma from ForumSerializer to keep diff clean

* Add permission to new seed migration
This commit is contained in:
David Sevilla Martín
2018-09-22 17:55:53 -04:00
committed by Franz Liedke
parent 4236f3d49e
commit 8c679c715c
3 changed files with 8 additions and 1 deletions

View File

@@ -48,7 +48,7 @@ class UserSerializer extends BasicUserSerializer
'canDelete' => $gate->allows('delete', $user),
];
if ($user->getPreference('discloseOnline')) {
if ($user->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $user)) {
$attributes += [
'lastSeenAt' => $this->formatDate($user->last_seen_at)
];