Skip to content

Commit

Permalink
Merge pull request #41 from eurofurence/bugfix/23-critters-can-see-st…
Browse files Browse the repository at this point in the history
…aff-internal-shifts

Closing Bugfix #23
  • Loading branch information
RustyBraze authored Sep 8, 2024
2 parents 00f9134 + c8017b0 commit bc43500
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
6 changes: 5 additions & 1 deletion includes/pages/user_shifts.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ function load_types()
)'
. ($isShico ? '' :
'WHERE angel_types.hide_on_shift_view = 0
OR user_angel_type.user_id IS NOT NULL ') .
OR (
user_angel_type.user_id IS NOT NULL
AND
NOT `user_angel_type`.`confirm_user_id` IS NULL
) ') .
'ORDER BY `angel_types`.`name`
',
[
Expand Down
39 changes: 25 additions & 14 deletions includes/view/AngelTypes_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,25 +520,36 @@ function AngelType_view(
'',
__('general.add')
) : '');

// Let's create the tabs as we go, so we can hide if needed
// Tab #1 -> INFO
$pagetabs = [
__('Info') => AngelType_view_info(
$angeltype,
$members,
$admin_user_angeltypes,
$admin_angeltypes,
$supporter
),
];
// Tab #2 -> Only if the user deserves :)
if ($admin_user_angeltypes ||
!$angeltype->hide_on_shift_view ||
($angeltype->hide_on_shift_view && (!is_null($user_angeltype) && $user_angeltype->confirm_user_id))) {
// Yup, you can see this: admin, not to hide or confirmed user
$pagetabs[__('general.shifts')] = AngelType_view_shifts(
$angeltype,
$shiftsFilterRenderer,
$shiftCalendarRenderer
);
}

return page_with_title(
$back . ' ' . sprintf(__('Team %s'), htmlspecialchars($angeltype->name)) . ' ' . $add,
[
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_license, $user),
msg(),
tabs([
__('Info') => AngelType_view_info(
$angeltype,
$members,
$admin_user_angeltypes,
$admin_angeltypes,
$supporter
),
__('general.shifts') => AngelType_view_shifts(
$angeltype,
$shiftsFilterRenderer,
$shiftCalendarRenderer
),
], $tab),
tabs($pagetabs, $tab),
],
true
);
Expand Down

0 comments on commit bc43500

Please sign in to comment.