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); $limit = $request->input('limit', 20);
$scope = $request->input('scope', 'inbox'); $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') { if(config('database.default') == 'pgsql') {
$dms = DirectMessage::when($scope === 'inbox', function($q, $scope) use($pid) { $dms = DirectMessage::when($scope === 'inbox', function($q, $scope) use($pid) {

File diff suppressed because it is too large Load diff