-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
ref(explorer): make session read only if owner_user_id doesnt match #105594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ interface QuestionActions { | |
| } | ||
|
|
||
| interface InputSectionProps { | ||
| enabled: boolean; | ||
| focusedBlockIndex: number; | ||
| inputValue: string; | ||
| interruptRequested: boolean; | ||
|
|
@@ -47,6 +48,7 @@ interface InputSectionProps { | |
| } | ||
|
|
||
| function InputSection({ | ||
| enabled, | ||
| inputValue, | ||
| focusedBlockIndex, | ||
| isMinimized = false, | ||
|
|
@@ -62,6 +64,9 @@ function InputSection({ | |
| questionActions, | ||
| }: InputSectionProps) { | ||
| const getPlaceholder = () => { | ||
| if (!enabled) { | ||
| return 'This conversation is owned by another user and is read-only'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be cool if we can look up the user name from the user ID. should be possible in the frontend. And some friendlier language like "Reading Andrew's conversation with Seer. Last updated 3hr ago." would be nice. (there should also be a util for the "ago" formatting) |
||
| } | ||
aliu39 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (focusedBlockIndex !== -1) { | ||
| return 'Press Tab ⇥ to return here'; | ||
| } | ||
|
|
@@ -70,7 +75,7 @@ function InputSection({ | |
|
|
||
| // Handle keyboard shortcuts for file approval | ||
| useEffect(() => { | ||
| if (!fileApprovalActions || !isVisible || isMinimized) { | ||
| if (!fileApprovalActions || !isVisible || isMinimized || !enabled) { | ||
| return undefined; | ||
| } | ||
|
|
||
|
|
@@ -94,11 +99,11 @@ function InputSection({ | |
|
|
||
| document.addEventListener('keydown', handleKeyDown); | ||
| return () => document.removeEventListener('keydown', handleKeyDown); | ||
| }, [fileApprovalActions, isVisible, isMinimized]); | ||
| }, [fileApprovalActions, isVisible, isMinimized, enabled]); | ||
|
|
||
| // Handle keyboard shortcuts for questions | ||
| useEffect(() => { | ||
| if (!questionActions || !isVisible || isMinimized) { | ||
| if (!questionActions || !isVisible || isMinimized || !enabled) { | ||
| return undefined; | ||
| } | ||
|
|
||
|
|
@@ -134,7 +139,27 @@ function InputSection({ | |
|
|
||
| document.addEventListener('keydown', handleKeyDown); | ||
| return () => document.removeEventListener('keydown', handleKeyDown); | ||
| }, [questionActions, isVisible, isMinimized]); | ||
| }, [questionActions, isVisible, isMinimized, enabled]); | ||
|
|
||
| if (!enabled) { | ||
| return ( | ||
| <InputBlock> | ||
| <StyledInputGroup> | ||
| <InputGroup.TextArea | ||
| disabled | ||
| ref={textAreaRef} | ||
| value={inputValue} | ||
| onChange={onInputChange} | ||
| onKeyDown={onKeyDown} | ||
| onClick={onInputClick} | ||
| placeholder={getPlaceholder()} | ||
| rows={1} | ||
| data-test-id="seer-explorer-input" | ||
| /> | ||
| </StyledInputGroup> | ||
| </InputBlock> | ||
| ); | ||
| } | ||
|
|
||
| // Render file approval action bar instead of entire input section | ||
| if (fileApprovalActions) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.