Fix for viewer permissions when viewing users in schedule (#1648)
# What this PR does Fix for #999
This commit is contained in:
parent
3e41cf8747
commit
30103762db
2 changed files with 38 additions and 34 deletions
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
|
||||
- Addressed bug with iOS mobile push notifications always being set to critical by @imtoori and @joeyorlando ([#1646](https://github.com/grafana/oncall/pull/1646))
|
||||
- Fixed issue where Viewer was not able to view which people were oncall in a schedule ([#999](https://github.com/grafana/oncall/issues/999))
|
||||
|
||||
## v1.2.3 (2023-03-28)
|
||||
|
||||
|
|
|
|||
|
|
@ -77,22 +77,51 @@ const ScheduleSlot: FC<ScheduleSlotProps> = observer((props) => {
|
|||
)}
|
||||
</div>
|
||||
) : (
|
||||
users.map(({ pk: userPk }, userIndex) => {
|
||||
users.map(({ display_name, pk: userPk }, userIndex) => {
|
||||
const storeUser = store.userStore.items[userPk];
|
||||
|
||||
// TODO remove
|
||||
if (!storeUser) {
|
||||
store.userStore.updateItem(userPk);
|
||||
}
|
||||
|
||||
const inactive = false;
|
||||
|
||||
const title = getTitle(storeUser);
|
||||
const title = storeUser ? getTitle(storeUser) : display_name;
|
||||
|
||||
const isOncall = Boolean(
|
||||
storeUser && onCallNow && onCallNow.some((onCallUser) => storeUser.pk === onCallUser.pk)
|
||||
);
|
||||
|
||||
const scheduleSlotContent = (
|
||||
<div
|
||||
className={cx('root', { root__inactive: inactive })}
|
||||
style={{
|
||||
backgroundColor: color,
|
||||
}}
|
||||
onMouseMove={trackMouse ? handleMouseMove : undefined}
|
||||
onMouseLeave={trackMouse ? () => setMouseX(0) : undefined}
|
||||
>
|
||||
{trackMouse && mouseX > 0 && <div style={{ left: `${mouseX}px` }} className={cx('time')} />}
|
||||
{storeUser && (
|
||||
<WorkingHours
|
||||
className={cx('working-hours')}
|
||||
timezone={storeUser.timezone}
|
||||
workingHours={storeUser.working_hours}
|
||||
startMoment={start}
|
||||
duration={duration}
|
||||
/>
|
||||
)}
|
||||
<div className={cx('title')}>
|
||||
{userIndex === 0 && label && (
|
||||
<div className={cx('label')} style={{ color }}>
|
||||
{label}
|
||||
</div>
|
||||
)}
|
||||
{title}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (!storeUser) {
|
||||
return scheduleSlotContent;
|
||||
} // show without a tooltip as we're lacking user info
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
key={userPk}
|
||||
|
|
@ -105,33 +134,7 @@ const ScheduleSlot: FC<ScheduleSlotProps> = observer((props) => {
|
|||
/>
|
||||
}
|
||||
>
|
||||
<div
|
||||
className={cx('root', { root__inactive: inactive })}
|
||||
style={{
|
||||
backgroundColor: color,
|
||||
}}
|
||||
onMouseMove={trackMouse ? handleMouseMove : undefined}
|
||||
onMouseLeave={trackMouse ? () => setMouseX(0) : undefined}
|
||||
>
|
||||
{trackMouse && mouseX > 0 && <div style={{ left: `${mouseX}px` }} className={cx('time')} />}
|
||||
{storeUser && (
|
||||
<WorkingHours
|
||||
className={cx('working-hours')}
|
||||
timezone={storeUser.timezone}
|
||||
workingHours={storeUser.working_hours}
|
||||
startMoment={start}
|
||||
duration={duration}
|
||||
/>
|
||||
)}
|
||||
<div className={cx('title')}>
|
||||
{userIndex === 0 && label && (
|
||||
<div className={cx('label')} style={{ color }}>
|
||||
{label}
|
||||
</div>
|
||||
)}
|
||||
{title}
|
||||
</div>
|
||||
</div>
|
||||
{scheduleSlotContent}
|
||||
</Tooltip>
|
||||
);
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue