Skip to content

Commit

Permalink
feat(ui): restrict thread interactions for non-owners (#3357)
Browse files Browse the repository at this point in the history
* feat(ui): hide action buttons for non-owners of the thread

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
liangfung and autofix-ci[bot] authored Nov 1, 2024
1 parent a7380b7 commit fd54b95
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 37 deletions.
47 changes: 26 additions & 21 deletions ee/tabby-ui/app/search/components/assistant-message-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,27 +329,32 @@ export function AssistantMessageSection({
{!isLoading && !isEditing && (
<div className="mt-3 flex items-center justify-between text-sm">
<div className="flex items-center gap-x-3">
{!isLoading &&
!fetchingContextInfo &&
isLastAssistantMessage && (
<Button
className="flex items-center gap-x-1 px-1 font-normal text-muted-foreground"
variant="ghost"
onClick={() => onRegenerateResponse(message.id)}
>
<IconRefresh />
<p>Regenerate</p>
</Button>
)}
{isDeletable && (
<Button
className="flex items-center gap-x-1 px-1 font-normal text-muted-foreground"
variant="ghost"
onClick={() => onDeleteMessage(message.id)}
>
<IconTrash />
<p>Delete</p>
</Button>
{isThreadOwner && (
<>
{!isLoading &&
!fetchingContextInfo &&
isLastAssistantMessage && (
<Button
className="flex items-center gap-x-1 px-1 font-normal text-muted-foreground"
variant="ghost"
onClick={() => onRegenerateResponse(message.id)}
>
<IconRefresh />
<p>Regenerate</p>
</Button>
)}

{isDeletable && (
<Button
className="flex items-center gap-x-1 px-1 font-normal text-muted-foreground"
variant="ghost"
onClick={() => onDeleteMessage(message.id)}
>
<IconTrash />
<p>Delete</p>
</Button>
)}
</>
)}
</div>
<div className="flex items-center gap-x-3">
Expand Down
38 changes: 22 additions & 16 deletions ee/tabby-ui/app/search/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,11 @@ export function Search() {
: {}
)}
>
<div className="flex items-center gap-4">
<div
className={cn('absolute flex items-center gap-4 ', {
'-top-10': isThreadOwner
})}
>
{stopButtonVisible && (
<Button
className="bg-background"
Expand All @@ -853,21 +857,23 @@ export function Search() {
</Button>
)}
</div>
<div
className={cn(
'relative z-20 flex justify-center self-stretch px-4'
)}
>
<TextAreaSearch
onSearch={onSubmitSearch}
className="min-h-[5rem] lg:max-w-4xl"
placeholder="Ask a follow up question"
isLoading={isLoading}
isFollowup
contextInfo={contextInfoData?.contextInfo}
fetchingContextInfo={fetchingContextInfo}
/>
</div>
{isThreadOwner && (
<div
className={cn(
'relative z-20 flex justify-center self-stretch px-4'
)}
>
<TextAreaSearch
onSearch={onSubmitSearch}
className="min-h-[5rem] lg:max-w-4xl"
placeholder="Ask a follow up question"
isLoading={isLoading}
isFollowup
contextInfo={contextInfoData?.contextInfo}
fetchingContextInfo={fetchingContextInfo}
/>
</div>
)}
</div>
</main>
</ResizablePanel>
Expand Down

0 comments on commit fd54b95

Please sign in to comment.