Edit delete permissions in package Chatter

Posted In Laravel
  • daniele-caluri 5 months ago
    I state by saying that I have also opened a ticket on github hoping for a response from the developer, but this one does not arrive and since this site uses this packages, I hope you can help me.
    
    The packages I'm talking about is: thedevdojo/chatter
    
    I just installed Chatter in my Laravel 5.7 and wanted to include moderation features.
    In my configuration the permissions are:
    
    $user->role 1 -> user
    $user->role 2 -> editor
    $user->role 3 -> moderator
    $user->role 4 -> admin
    
    I have seen that only the message owner can modify or delete the message and if I have not seen badly, it is the function destroy in ChatterPostController.php
    
    >         $post = Models::post()->with('discussion','user')->findOrFail($id);
    > 
    >         if ($request->user()->id !== (int) $post->user_id && $request->user()->role === '1') {
    >             return redirect('/'.config('chatter.routes.home'))->with([
    >                 'chatter_alert_type' => 'danger',
    >                 'chatter_alert'      => trans('chatter::alert.danger.reason.destroy_post'),
    >             ]);
    >         }
    > 
    >         if ($post->discussion->posts()->oldest()->first()->id === $post->id || $post->user->role === '4') {
    >             if(config('chatter.soft_deletes')) {
    >                 $post->discussion->posts()->delete();
    >                 $post->discussion()->delete();
    >             } else {
    >                 $post->discussion->posts()->forceDelete();
    >                 $post->discussion()->forceDelete();
    >             }
    > 
    >             return redirect('/'.config('chatter.routes.home'))->with([
    >                 'chatter_alert_type' => 'success',
    >                 'chatter_alert'      => trans('chatter::alert.success.reason.destroy_post'),
    >             ]);
    >         }
    
    But if I have messages in the topic:
    
    ID 1
    ID 1
    ID 7
    
    (And I'm ID 7)
    
    when I delete the second ID1 message, my message (ID7) is also deleted.
    
    Is it possible that there is no integrated moderation system in the forum system?

    I state by saying that I have also opened a ticket on github hoping for a response from the developer, but this one does not arrive and since this site uses this packages, I hope you can help me.

    The packages I'm talking about is: thedevdojo/chatter

    I just installed Chatter in my Laravel 5.7 and wanted to include moderation features. In my configuration the permissions are:

    $user->role 1 -> user $user->role 2 -> editor $user->role 3 -> moderator $user->role 4 -> admin

    I have seen that only the message owner can modify or delete the message and if I have not seen badly, it is the function destroy in ChatterPostController.php

        $post = Models::post()->with('discussion','user')->findOrFail($id);
    
        if ($request->user()->id !== (int) $post->user_id && $request->user()->role === '1') {
            return redirect('/'.config('chatter.routes.home'))->with([
                'chatter_alert_type' => 'danger',
                'chatter_alert'      => trans('chatter::alert.danger.reason.destroy_post'),
            ]);
        }
    
        if ($post->discussion->posts()->oldest()->first()->id === $post->id || $post->user->role === '4') {
            if(config('chatter.soft_deletes')) {
                $post->discussion->posts()->delete();
                $post->discussion()->delete();
            } else {
                $post->discussion->posts()->forceDelete();
                $post->discussion()->forceDelete();
            }
    
            return redirect('/'.config('chatter.routes.home'))->with([
                'chatter_alert_type' => 'success',
                'chatter_alert'      => trans('chatter::alert.success.reason.destroy_post'),
            ]);
        }
    

    But if I have messages in the topic:

    ID 1 ID 1 ID 7

    (And I'm ID 7)

    when I delete the second ID1 message, my message (ID7) is also deleted.

    Is it possible that there is no integrated moderation system in the forum system?

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
Want to create your own SAAS?

I can teach you to create your own Software as a Service. Click here to learn more!

Visit SAAS Adventure!