Update DirectMessageController, add parental controls support

This commit is contained in:
Daniel Supernault 2024-01-11 05:25:23 -07:00
parent fd9b5ad443
commit fe30cd25d1
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1
2 changed files with 867 additions and 837 deletions

View File

@ -2575,7 +2575,11 @@ class ApiV1Controller extends Controller
$limit = $request->input('limit', 20);
$scope = $request->input('scope', 'inbox');
$pid = $request->user()->profile_id;
$user = $request->user();
if($user->has_roles && !UserRoleService::can('can-direct-message', $user->id)) {
return [];
}
$pid = $user->profile_id;
if(config('database.default') == 'pgsql') {
$dms = DirectMessage::when($scope === 'inbox', function($q, $scope) use($pid) {

File diff suppressed because it is too large Load Diff