From 2f7bc2c926de969bdaa0a1c6ece990a886dac32c Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Tue, 7 Feb 2023 15:48:45 +0100 Subject: [PATCH 1/7] feat(chalice): force SSO for wrong user credentials --- ee/api/chalicelib/core/users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index f050811ab..df713dca8 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -740,6 +740,8 @@ def authenticate(email, password, for_change_password=False): "email": email, **r } + if config("enforce_SSO", cast=bool, default=False) and helper.is_saml2_available(): + return {"errors": ["must sign-in with SSO, enforced by admin"]} return None From e02f1fa278db5a08a637fdd46fd3f7ec689073c6 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Tue, 7 Feb 2023 13:02:54 +0100 Subject: [PATCH 2/7] fix(ui): fix notes asking for channels too much --- .../Player/Controls/components/CreateNote.tsx | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx b/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx index 0daf840ec..c51f8a54c 100644 --- a/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx +++ b/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx @@ -68,9 +68,11 @@ function CreateNote({ React.useEffect(() => { if (inputRef.current && isVisible) { - fetchSlack(); - fetchTeams(); inputRef.current.focus(); + if (teamsChannels.size === 0 || slackChannels.size === 0) { + fetchSlack(); + fetchTeams(); + } } }, [isVisible]); @@ -79,7 +81,7 @@ function CreateNote({ const cleanUp = () => { setCreateNoteTooltip({ isVisible: false, time: 0 }); setText(''); - setTag(undefined); + setTag(TAGS[0]); } const onSubmit = () => { if (text === '') return; @@ -100,12 +102,12 @@ function CreateNote({ }; if (isEdit) { return notesStore - .updateNote(editNote.noteId, note) + .updateNote(editNote.noteId!, note) .then((r) => { toast.success('Note updated'); - notesStore.fetchSessionNotes(sessionId).then((notes) => { - onSuccess(editNote.noteId); - updateNote(r); + notesStore.fetchSessionNotes(sessionId).then(() => { + onSuccess(editNote.noteId!); + updateNote(r as Note); }); }) .catch((e) => { @@ -120,10 +122,10 @@ function CreateNote({ return notesStore .addNote(sessionId, note) .then((r) => { - onSuccess(r.noteId as unknown as string); + onSuccess(r!.noteId as unknown as string); toast.success('Note added'); - notesStore.fetchSessionNotes(sessionId).then((notes) => { - addNote(r); + notesStore.fetchSessionNotes(sessionId).then(() => { + addNote(r as Note); }); }) .catch((e) => { @@ -159,14 +161,16 @@ function CreateNote({ })) .toJS() as unknown as { value: string; label: string }[]; + // @ts-ignore slackChannelsOptions.unshift({ value: null, label: 'Pick a channel' }); + // @ts-ignore teamsChannelsOptions.unshift({ value: null, label: 'Pick a channel' }); - const changeSlackChannel = ({ value, name }: { value: Record; name: string }) => { + const changeSlackChannel = ({ value }: { value: Record; name: string }) => { setSlackChannel(value.value); }; - const changeTeamsChannel = ({ value, name }: { value: Record; name: string }) => { + const changeTeamsChannel = ({ value }: { value: Record; name: string }) => { setTeamsChannel(value.value); }; From faefe14ac533ab2138ce680143fcb9a2adce4b4c Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Tue, 7 Feb 2023 13:44:20 +0100 Subject: [PATCH 3/7] fix(ui): restrict changing playtime in live without file, remove unnec /channel calls and add loader --- .../Session/Player/LivePlayer/Timeline.tsx | 7 +- .../shared/SharePopup/SharePopup.js | 196 ++++++++++-------- .../app/components/ui/Popover/Popover.tsx | 7 +- frontend/app/player/web/WebLivePlayer.ts | 3 + 4 files changed, 118 insertions(+), 95 deletions(-) diff --git a/frontend/app/components/Session/Player/LivePlayer/Timeline.tsx b/frontend/app/components/Session/Player/LivePlayer/Timeline.tsx index 2bddec240..cba5547b9 100644 --- a/frontend/app/components/Session/Player/LivePlayer/Timeline.tsx +++ b/frontend/app/components/Session/Player/LivePlayer/Timeline.tsx @@ -95,11 +95,10 @@ function Timeline(props: IProps) { const loadAndSeek = async (e: React.MouseEvent) => { e.persist(); - await player.toggleTimetravel(); - - setTimeout(() => { + const result = await player.toggleTimetravel(); + if (result) { seekProgress(e); - }); + } }; const jumpToTime = (e: React.MouseEvent) => { diff --git a/frontend/app/components/shared/SharePopup/SharePopup.js b/frontend/app/components/shared/SharePopup/SharePopup.js index 5e01dde3d..984ce0060 100644 --- a/frontend/app/components/shared/SharePopup/SharePopup.js +++ b/frontend/app/components/shared/SharePopup/SharePopup.js @@ -1,7 +1,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { toast } from 'react-toastify'; -import { Icon, Button, Popover } from 'UI'; +import { Icon, Button, Popover, Loader } from 'UI'; import styles from './sharePopup.module.css'; import IntegrateSlackButton from '../IntegrateSlackButton/IntegrateSlackButton'; import SessionCopyLink from './SessionCopyLink'; @@ -29,12 +29,14 @@ export default class SharePopup extends React.PureComponent { loadingTeams: false, }; - componentDidMount() { - if (this.props.channels.size === 0) { - this.props.fetchSlack(); - } - if (this.props.msTeamsChannels.size === 0) { - this.props.fetchTeams(); + componentDidUpdate() { + if (this.state.isOpen) { + if (this.props.channels.size === 0) { + this.props.fetchSlack(); + } + if (this.props.msTeamsChannels.size === 0) { + this.props.fetchTeams(); + } } } @@ -76,7 +78,10 @@ export default class SharePopup extends React.PureComponent { }; handleSuccess = (endpoint) => { - const obj = endpoint === 'Slack' ? { isOpen: false, comment: '', loadingSlack: false } : { isOpen: false, comment: '', loadingTeams: false } + const obj = + endpoint === 'Slack' + ? { isOpen: false, comment: '', loadingSlack: false } + : { isOpen: false, comment: '', loadingTeams: false }; this.setState(obj); toast.success(`Sent to ${endpoint}.`); }; @@ -103,91 +108,104 @@ export default class SharePopup extends React.PureComponent { return ( this.setState({ isOpen: true })} + onClose={() => this.setState({ isOpen: false })} render={() => (
-
-
- Share this session link to Slack/MS Teams -
-
- {slackOptions.length > 0 || msTeamsOptions.length > 0 ? ( -
-
-