diff --git a/app/containers/IssueView/TrackingBar/WorklogCommentDialog/WorklogCommentDialog.jsx b/app/containers/IssueView/TrackingBar/WorklogCommentDialog/WorklogCommentDialog.jsx index 3e6956598..1662c1fc9 100644 --- a/app/containers/IssueView/TrackingBar/WorklogCommentDialog/WorklogCommentDialog.jsx +++ b/app/containers/IssueView/TrackingBar/WorklogCommentDialog/WorklogCommentDialog.jsx @@ -23,6 +23,7 @@ import { EditButtonContainer, } from './styled'; +import WorklogCommentOptions from './WorklogCommentOptions'; type Props = { issue: Issue, @@ -106,6 +107,7 @@ class WorklogCommentDialog extends PureComponent { onConfirm={this.onConfirm} onCancel={this.onCancel} /> + void, +}; + +const WorklogCommentOptions: StatelessFunctionalComponent = ({ + postAlsoAsIssueComment, + changePostOption, +}: Props): Node => + + + + + ; + +export default compose( + connect( + state => ({ + postAlsoAsIssueComment: getUiState('postAlsoAsIssueComment')(state), + }), + dispatch => ({ dispatch }), + ), + withHandlers({ + changePostOption: ({ + dispatch, + postAlsoAsIssueComment, + }: { + postAlsoAsIssueComment: boolean, + dispatch: Dispatch, + }) => () => dispatch(uiActions.setUiState('postAlsoAsIssueComment', !postAlsoAsIssueComment)) + }) +)(WorklogCommentOptions); diff --git a/app/containers/IssueView/TrackingBar/WorklogCommentDialog/styled/index.jsx b/app/containers/IssueView/TrackingBar/WorklogCommentDialog/styled/index.jsx index 9d44d4cac..afec11aa2 100644 --- a/app/containers/IssueView/TrackingBar/WorklogCommentDialog/styled/index.jsx +++ b/app/containers/IssueView/TrackingBar/WorklogCommentDialog/styled/index.jsx @@ -18,3 +18,7 @@ export const EditButton = styled(EditFilledIcon)` export const EditButtonContainer = styled.div` cursor: pointer; `; + +export const IssueCommentCheckboxWrapper = styled.div` + margin-left: -10px; +`; diff --git a/app/reducers/ui.js b/app/reducers/ui.js index 810bea0c3..07bf79a3b 100644 --- a/app/reducers/ui.js +++ b/app/reducers/ui.js @@ -45,6 +45,7 @@ const initialState: UiState = { editWorklogId: null, worklogFormIssueId: null, worklogComment: '', + postAlsoAsIssueComment: false, remainingEstimateValue: 'auto', remainingEstimateNewValue: '', remainingEstimateReduceByValue: '', diff --git a/app/sagas/worklogs.js b/app/sagas/worklogs.js index 22029b37f..541a0475a 100644 --- a/app/sagas/worklogs.js +++ b/app/sagas/worklogs.js @@ -22,6 +22,7 @@ import { import { types, uiActions, + issuesActions, } from 'actions'; import { getResourceIds, @@ -266,9 +267,15 @@ export function* uploadWorklog(options: any): Generator<*, *, *> { }, }); + const postAlsoAsIssueComment = yield select(getUiState('postAlsoAsIssueComment')); + if (postAlsoAsIssueComment && options.comment) { + yield put(issuesActions.commentRequest(options.comment, options.issueId)); + } + // reset ui state yield put(uiActions.resetUiState([ 'worklogComment', + 'postAlsoAsIssueComment', 'remainingEstimateValue', 'remainingEstimateNewValue', 'remainingEstimateReduceByValue', diff --git a/app/types/ui.js b/app/types/ui.js index 48aded22a..7acdbef3d 100644 --- a/app/types/ui.js +++ b/app/types/ui.js @@ -89,6 +89,7 @@ export type UiState = {| editWorklogId: Id | null, worklogFormIssueId: Id | null, worklogComment: string, + postAlsoAsIssueComment: boolean, remainingEstimateValue: RemainingEstimate, remainingEstimateNewValue: string, remainingEstimateReduceByValue: string,