aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/pages/bug/CommentForm.tsx
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-05-25 21:02:25 +0200
committerGitHub <noreply@github.com>2021-05-25 21:02:25 +0200
commitbfad28d7feb3009de624c59edcfe670aa3832841 (patch)
tree9127b3ebd9ad37f5d38368e30e8e1fdb75d3c393 /webui/src/pages/bug/CommentForm.tsx
parent24a78c86f494b0d148d888747fc661da927b8c59 (diff)
parent970c1cf1ab55df3d894c1c0a2bc9654b6f2b5c43 (diff)
downloadgit-bug-bfad28d7feb3009de624c59edcfe670aa3832841.tar.gz
Merge pull request #680 from GlancingMind/webui-comment-and-close-bug
WebUI: Support comment-and-close of a bug in one step
Diffstat (limited to 'webui/src/pages/bug/CommentForm.tsx')
-rw-r--r--webui/src/pages/bug/CommentForm.tsx15
1 files changed, 9 insertions, 6 deletions
diff --git a/webui/src/pages/bug/CommentForm.tsx b/webui/src/pages/bug/CommentForm.tsx
index a8ce4319..1a7ebc29 100644
--- a/webui/src/pages/bug/CommentForm.tsx
+++ b/webui/src/pages/bug/CommentForm.tsx
@@ -6,6 +6,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
import CommentInput from '../../components/CommentInput/CommentInput';
import CloseBugButton from 'src/components/CloseBugButton/CloseBugButton';
+import CloseBugWithCommentButton from 'src/components/CloseBugWithCommentButton/CloseBugWithCommentButton';
import ReopenBugButton from 'src/components/ReopenBugButton/ReopenBugButton';
import { BugFragment } from './Bug.generated';
@@ -77,11 +78,13 @@ function CommentForm({ bug }: Props) {
if (issueComment.length > 0) submit();
};
- function getCloseButton() {
- return <CloseBugButton bug={bug} disabled={issueComment.length > 0} />;
- }
-
- function getReopenButton() {
+ function getBugStatusButton() {
+ if (bug.status === 'OPEN' && issueComment.length > 0) {
+ return <CloseBugWithCommentButton bug={bug} comment={issueComment} />;
+ }
+ if (bug.status === 'OPEN') {
+ return <CloseBugButton bug={bug} />;
+ }
return <ReopenBugButton bug={bug} disabled={issueComment.length > 0} />;
}
@@ -94,7 +97,7 @@ function CommentForm({ bug }: Props) {
onChange={(comment: string) => setIssueComment(comment)}
/>
<div className={classes.actions}>
- {bug.status === 'OPEN' ? getCloseButton() : getReopenButton()}
+ {getBugStatusButton()}
<Button
className={classes.greenButton}
variant="contained"