mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 04:53:17 +00:00
Update ComposeController, add parental controls support
This commit is contained in:
parent
1a16ec2078
commit
2dcfc81495
2 changed files with 661 additions and 630 deletions
|
@ -1750,6 +1750,8 @@ class ApiV1Controller extends Controller
|
|||
]);
|
||||
|
||||
$user = $request->user();
|
||||
abort_if($user->has_roles && !UserRoleService::can('can-post', $user->id), 403, 'Invalid permissions for this action');
|
||||
|
||||
AccountService::setLastActive($user->id);
|
||||
|
||||
$media = Media::whereUserId($user->id)
|
||||
|
@ -2983,6 +2985,15 @@ class ApiV1Controller extends Controller
|
|||
$in_reply_to_id = $request->input('in_reply_to_id');
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
if($user->has_roles) {
|
||||
if($in_reply_to_id != null) {
|
||||
abort_if(!UserRoleService::can('can-comment', $user->id), 403, 'Invalid permissions for this action');
|
||||
} else {
|
||||
abort_if(!UserRoleService::can('can-post', $user->id), 403, 'Invalid permissions for this action');
|
||||
}
|
||||
}
|
||||
|
||||
$profile = $user->profile;
|
||||
|
||||
$limitKey = 'compose:rate-limit:store:' . $user->id;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue