mirror of
https://github.com/flarum/framework.git
synced 2025-01-22 23:40:45 +08: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:
parent
5bd13b0c22
commit
46ef76266a
|
@ -110,6 +110,12 @@ export default class PermissionGrid extends Component {
|
|||
})
|
||||
}, 90);
|
||||
|
||||
items.add('viewLastSeenAt', {
|
||||
icon: 'far fa-clock',
|
||||
label: app.translator.trans('core.admin.permissions.view_last_seen_at_label'),
|
||||
permission: 'user.viewLastSeenAt',
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ $rows = [
|
|||
['permission' => 'discussion.hidePosts', 'group_id' => Group::MODERATOR_ID],
|
||||
['permission' => 'discussion.rename', 'group_id' => Group::MODERATOR_ID],
|
||||
['permission' => 'discussion.viewIpsPosts', 'group_id' => Group::MODERATOR_ID],
|
||||
['permission' => 'user.viewLastSeenAt', 'group_id' => Group::MODERATOR_ID],
|
||||
];
|
||||
|
||||
return [
|
||||
|
|
|
@ -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)
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue
Block a user