Skip to content

Commit

Permalink
105 bugfix delete group success as owner test (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
HabuTheTiger authored Nov 28, 2024
2 parents d46561b + 7ef027f commit c77f2d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions app/Observers/GroupObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ class GroupObserver
{
public function created(Group $group)
{
if (App::isLocal()) {
return;
}

if ($group->type === GroupTypeEnum::Team && $group->parent->nextcloud_folder_id) {
if (! App::isProduction() && $group->type === GroupTypeEnum::Team && $group->parent?->nextcloud_folder_id) {
NextcloudService::createGroup($group->hashid);
// Parent->name / Group->name
NextcloudService::setDisplayName($group->hashid, $group->parent->name . ' / ' . $group->name);
Expand All @@ -35,7 +31,7 @@ public function created(Group $group)

public function updated(Group $group): void
{
if (App::isLocal()) {
if (! App::isProduction()) {
return;
}

Expand Down Expand Up @@ -71,7 +67,7 @@ public function updated(Group $group): void

public function deleted(Group $group)
{
if (App::isLocal()) {
if (! App::isProduction()) {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion tests/Feature/Api/v1/GroupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@
});

test('Delete Group success as Owner', function () {
$group = Group::factory()->create();
$group = Group::factory()->create([
'type' => GroupTypeEnum::Team,
]);

$user = Sanctum::actingAs(
User::factory()->create(),
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/Staff/GroupMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

$this->actingAs($user, 'staff');

var_dump(GroupUserLevel::Admin->name);

$response = patchJson(
route('staff.groups.members.update', ['group' => $group, 'member' => $userToBeUpdated]),
['level' => GroupUserLevel::Admin->value],
Expand Down

0 comments on commit c77f2d4

Please sign in to comment.