[COMPONENT][Group] More flexible member roles than only isAdmin

Refactor terminology of canAdmin to match current roles system
This commit is contained in:
2022-02-14 04:35:13 +00:00
parent bc63c3727a
commit 3f9c86f0df
7 changed files with 20 additions and 15 deletions

View File

@@ -88,7 +88,7 @@ class DeleteNote extends NoteHandlerPlugin
private static function undertaker(Actor $actor, Note $note): Activity
{
// Check permissions
if (!$actor->canAdmin($note->getActor())) {
if (!$actor->canModerate($note->getActor())) {
throw new ClientException(_m('You don\'t have permissions to delete this note.'), 401);
}
@@ -167,7 +167,7 @@ class DeleteNote extends NoteHandlerPlugin
fn () => DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true),
))
// And has permissions
&& $actor->canAdmin($note->getActor())) {
&& $actor->canModerate($note->getActor())) {
$delete_action_url = Router::url('delete_note_action', ['note_id' => $note->getId()]);
$query_string = $request->getQueryString();
$delete_action_url .= '?from=' . mb_substr($query_string, 2);