Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(comments): allow selecting multiple attachments
李冠辰963ed5cd0efc
diff --git a/packages/ui/components/common/file-upload-button.tsx b/packages/ui/components/common/file-upload-button.tsxindex d33f0ab4b4..bae3d03f0e 100644--- a/packages/ui/components/common/file-upload-button.tsx+++ b/packages/ui/components/common/file-upload-button.tsx@@ -11,6 +11,7 @@ interface FileUploadButtonProps {disabled?: boolean;className?: string;size?: "sm" | "default";+ multiple?: boolean;}function FileUploadButton({@@ -18,16 +19,17 @@ function FileUploadButton({disabled,className,size = "default",+ multiple = false,}: FileUploadButtonProps) {const { t } = useTranslation("ui");const inputRef = useRef<HTMLInputElement>(null);const attachLabel = t(($) => $.attach_file);const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {- const file = e.target.files?.[0];- if (!file) return;+ const files = Array.from(e.target.files ?? []);+ if (files.length === 0) return;e.target.value = "";- onSelect(file);+ for (const file of files) onSelect(file);};const iconSize = size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4";@@ -52,6 +54,7 @@ function FileUploadButton({<inputref={inputRef}type="file"+ multiple={multiple}className="hidden"onChange={handleChange}/>diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsxindex 92fba66835..41c1a1faca 100644--- a/packages/views/issues/components/comment-card.tsx+++ b/packages/views/issues/components/comment-card.tsx@@ -434,6 +434,7 @@ function CommentRow({)}<FileUploadButtonsize="sm"+ multipleonSelect={(file) => editEditorRef.current?.uploadFile(file)}/></div>@@ -760,6 +761,7 @@ function CommentCardImpl({)}<FileUploadButtonsize="sm"+ multipleonSelect={(file) => editEditorRef.current?.uploadFile(file)}/></div>diff --git a/packages/views/issues/components/comment-input.tsx b/packages/views/issues/components/comment-input.tsxindex 0a77dc31c0..5223b9fa5b 100644--- a/packages/views/issues/components/comment-input.tsx+++ b/packages/views/issues/components/comment-input.tsx@@ -135,6 +135,7 @@ function CommentInput({ issueId, onSubmit }: CommentInputProps) {</Tooltip><FileUploadButtonsize="sm"+ multipleonSelect={(file) => editorRef.current?.uploadFile(file)}/><SubmitButtondiff --git a/packages/views/issues/components/reply-input.tsx b/packages/views/issues/components/reply-input.tsxindex 7b944f227d..4f36126adf 100644--- a/packages/views/issues/components/reply-input.tsx+++ b/packages/views/issues/components/reply-input.tsx@@ -166,6 +166,7 @@ function ReplyInput({</Tooltip><FileUploadButtonsize="sm"+ multipleonSelect={(file) => editorRef.current?.uploadFile(file)}/><button