diff --git a/app/Http/Controllers/GroupController.php b/app/Http/Controllers/GroupController.php
index 6677de97f..8021f3a22 100644
--- a/app/Http/Controllers/GroupController.php
+++ b/app/Http/Controllers/GroupController.php
@@ -503,7 +503,9 @@ public function edit(Request $request, $id, Geocoder $geocoder)
'id' => $id,
'name' => $group->name,
'audits' => $group->audits,
- 'networks' => Network::all()
+ 'networks' => Network::all(),
+ 'can_approve' => Fixometer::hasRole($user, 'Administrator') ||
+ Fixometer::hasRole($user, 'NetworkCoordinator') && $isCoordinatorForGroup
]);
}
diff --git a/resources/views/group/edit.blade.php b/resources/views/group/edit.blade.php
index c660922bf..ce7f2fca5 100644
--- a/resources/views/group/edit.blade.php
+++ b/resources/views/group/edit.blade.php
@@ -19,7 +19,7 @@
diff --git a/tests/Feature/Groups/GroupEditTest.php b/tests/Feature/Groups/GroupEditTest.php
index 86df3762f..c29ec1254 100644
--- a/tests/Feature/Groups/GroupEditTest.php
+++ b/tests/Feature/Groups/GroupEditTest.php
@@ -4,6 +4,7 @@
use App\Group;
use App\GroupTags;
+use App\Network;
use App\Role;
use App\User;
use Carbon\Carbon;
@@ -189,4 +190,33 @@ public function edit_email()
$group->refresh();
$this->assertEquals('info@test.com', $group->email);
}
+
+ public function testEditAsNetworkCoordinator() {
+ $network = Network::factory()->create();
+ $coordinator = User::factory()->restarter()->create();
+ $network->addCoordinator($coordinator);
+ $coordinator->refresh();
+ $this->actingAs($coordinator);
+
+ $idgroups = $this->createGroup(
+ 'Test Group',
+ 'https://therestartproject.org',
+ 'London',
+ 'Some text.',
+ true,
+ false,
+ 'info@test.com'
+ );
+
+ $response = $this->get('/group/edit/' . $idgroups);
+ $response->assertStatus(200);
+
+ // Shouldn't be able to approve the group, as it has not yet been put in our network (by an admin).
+ $this->assertVueProperties($response, [
+ [],
+ [
+ ':can-approve' => 'false',
+ ],
+ ]);
+ }
}