Skip to content

Commit

Permalink
feat(groups): Allow specifying the notice state
Browse files Browse the repository at this point in the history
  • Loading branch information
zooley committed Jul 25, 2024
1 parent 2da98c2 commit 80fbda4
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions app/Modules/Groups/Http/Controllers/Api/MembersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ public function create(Request $request)
'userid' => 'required',
'membertype' => 'nullable|integer',
'userrequestid' => 'nullable|integer',
'notice' => 'nullable|integer',
];

$validator = Validator::make($request->all(), $rules);
Expand Down Expand Up @@ -409,17 +410,24 @@ public function create(Request $request)
}
}

// Notify other managers of this person being made a manager
if ($row->isManager())
if ($request->has('notice'))
{
$row->notice = Member::MEMBERSHIP_AUTHORIZED;
$row->notice = $request->input('notice', Member::NO_NOTICE);
}

// Do we have any owners?
// If not, there's no one else to notify
if (count($row->group->managers) == 0)
else
{
$row->notice = Member::NO_NOTICE;
// Notify other managers of this person being made a manager
if ($row->isManager())
{
$row->notice = Member::MEMBERSHIP_AUTHORIZED;
}

// Do we have any owners?
// If not, there's no one else to notify
if (count($row->group->managers) == 0)
{
$row->notice = Member::NO_NOTICE;
}
}

$row->userrequestid = $request->input('userrequestid', 0);
Expand Down

0 comments on commit 80fbda4

Please sign in to comment.