From 901391f9b5db85d6cf2286f3d20681f4f721bceb Mon Sep 17 00:00:00 2001
From: Rachael Parris <43251054+rachaelparris@users.noreply.github.com>
Date: Thu, 18 Jun 2020 13:26:35 -0700
Subject: [PATCH 1/3] 4609: forward message modal
---
...rwardMessageModalDialogModalStateAction.js | 23 +++
...MessageModalDialogModalStateAction.test.js | 51 ++++++
.../openForwardMessageModalSequence.js | 4 +
.../ForwardCaseMessageModalDialog.jsx | 153 +++++++++++++++++-
4 files changed, 228 insertions(+), 3 deletions(-)
create mode 100644 web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js
create mode 100644 web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js
diff --git a/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js
new file mode 100644
index 00000000000..a1b4c8d81cc
--- /dev/null
+++ b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js
@@ -0,0 +1,23 @@
+import { state } from 'cerebral';
+
+/**
+ * set the modal state
+ *
+ * @param {object} providers the providers object
+ * @param {object} providers.store the cerebral store function
+ */
+export const setForwardMessageModalDialogModalStateAction = ({
+ get,
+ store,
+}) => {
+ const messageDetail = get(state.messageDetail)[0]; //todo in later task
+ store.set(state.modal.validationErrors, {});
+ store.set(state.modal.form, {
+ attachments: messageDetail.attachments,
+ from: messageDetail.from,
+ fromSection: messageDetail.fromSection,
+ fromUserId: messageDetail.fromUserId,
+ parentMessageId: messageDetail.parentMessageId,
+ subject: messageDetail.subject,
+ });
+};
diff --git a/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js
new file mode 100644
index 00000000000..77971ec0ffe
--- /dev/null
+++ b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js
@@ -0,0 +1,51 @@
+import { presenter } from '../../presenter-mock';
+import { runAction } from 'cerebral/test';
+import { setForwardMessageModalDialogModalStateAction } from './setForwardMessageModalDialogModalStateAction';
+
+describe('setForwardMessageModalDialogModalStateAction', () => {
+ it('should set the modal state for replying to a message', async () => {
+ const result = await runAction(
+ setForwardMessageModalDialogModalStateAction,
+ {
+ modules: {
+ presenter,
+ },
+ props: {},
+ state: {
+ messageDetail: [
+ {
+ attachments: [
+ {
+ documentId: 'a5273185-f694-4d9c-bc90-71eddc5e5937',
+ documentTitle: 'Petition',
+ },
+ ],
+ from: 'test user 1',
+ fromSection: 'petitions',
+ fromUserId: '589002b0-dacd-4e84-874a-52d9898623c3',
+ parentMessageId: '530f9b43-4934-4b2f-9aa4-50dcbe8064fa',
+ subject: 'the subject',
+ },
+ ],
+ },
+ },
+ );
+
+ expect(result.state.modal).toEqual({
+ form: {
+ attachments: [
+ {
+ documentId: 'a5273185-f694-4d9c-bc90-71eddc5e5937',
+ documentTitle: 'Petition',
+ },
+ ],
+ from: 'test user 1',
+ fromSection: 'petitions',
+ fromUserId: '589002b0-dacd-4e84-874a-52d9898623c3',
+ parentMessageId: '530f9b43-4934-4b2f-9aa4-50dcbe8064fa',
+ subject: 'the subject',
+ },
+ validationErrors: {},
+ });
+ });
+});
diff --git a/web-client/src/presenter/sequences/openForwardMessageModalSequence.js b/web-client/src/presenter/sequences/openForwardMessageModalSequence.js
index 7fc66575c1c..33e5c9e0484 100644
--- a/web-client/src/presenter/sequences/openForwardMessageModalSequence.js
+++ b/web-client/src/presenter/sequences/openForwardMessageModalSequence.js
@@ -1,5 +1,9 @@
+import { clearModalStateAction } from '../actions/clearModalStateAction';
+import { setForwardMessageModalDialogModalStateAction } from '../actions/WorkItem/setForwardMessageModalDialogModalStateAction';
import { setShowModalFactoryAction } from '../actions/setShowModalFactoryAction';
export const openForwardMessageModalSequence = [
+ clearModalStateAction,
+ setForwardMessageModalDialogModalStateAction,
setShowModalFactoryAction('ForwardMessageModal'),
];
diff --git a/web-client/src/views/Messages/ForwardCaseMessageModalDialog.jsx b/web-client/src/views/Messages/ForwardCaseMessageModalDialog.jsx
index 1850dad546d..dd6de2223e1 100644
--- a/web-client/src/views/Messages/ForwardCaseMessageModalDialog.jsx
+++ b/web-client/src/views/Messages/ForwardCaseMessageModalDialog.jsx
@@ -1,10 +1,35 @@
+import { CaseMessageModalAttachments } from './CaseMessageModalAttachments';
import { ConfirmModal } from '../../ustc-ui/Modal/ConfirmModal';
+import { FormGroup } from '../../ustc-ui/FormGroup/FormGroup';
import { connect } from '@cerebral/react';
+import { sequences, state } from 'cerebral';
import React from 'react';
export const ForwardCaseMessageModalDialog = connect(
- {},
- function ForwardCaseMessageModalDialog() {
+ {
+ constants: state.constants,
+ form: state.modal.form,
+ showChambersSelect: state.modal.showChambersSelect,
+ updateCreateCaseMessageValueInModalSequence:
+ sequences.updateCreateCaseMessageValueInModalSequence,
+ updateModalValueSequence: sequences.updateModalValueSequence,
+ users: state.users,
+ validateCreateCaseMessageInModalSequence:
+ sequences.validateCreateCaseMessageInModalSequence,
+ validationErrors: state.validationErrors,
+ workQueueSectionHelper: state.workQueueSectionHelper,
+ },
+ function ForwardCaseMessageModalDialog({
+ constants,
+ form,
+ showChambersSelect,
+ updateCreateCaseMessageValueInModalSequence,
+ updateModalValueSequence,
+ users,
+ validateCreateCaseMessageInModalSequence,
+ validationErrors,
+ workQueueSectionHelper,
+ }) {
return (
{}}
- >
+ >
+
+
+
+
+
+ {showChambersSelect && (
+
+
+
+
+ )}
+
+
+
+
+
+
+
+ {
+ updateModalValueSequence({
+ key: e.target.name,
+ value: e.target.value,
+ });
+ validateCreateCaseMessageInModalSequence();
+ }}
+ />
+
+
+
+
+
+
+
+
);
},
);
From fda8426f8a6aa83c5d1c3a7e38c63924f1452e6b Mon Sep 17 00:00:00 2001
From: Rachael Parris <43251054+rachaelparris@users.noreply.github.com>
Date: Thu, 18 Jun 2020 13:27:35 -0700
Subject: [PATCH 2/3] test description update
---
.../setForwardMessageModalDialogModalStateAction.test.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js
index 77971ec0ffe..78973d010a3 100644
--- a/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js
+++ b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.test.js
@@ -3,7 +3,7 @@ import { runAction } from 'cerebral/test';
import { setForwardMessageModalDialogModalStateAction } from './setForwardMessageModalDialogModalStateAction';
describe('setForwardMessageModalDialogModalStateAction', () => {
- it('should set the modal state for replying to a message', async () => {
+ it('should set the modal state for forwarding a message', async () => {
const result = await runAction(
setForwardMessageModalDialogModalStateAction,
{
From 9cc592f344f25fc2a287e4f7ba2aac12238df959 Mon Sep 17 00:00:00 2001
From: Rachael Parris <43251054+rachaelparris@users.noreply.github.com>
Date: Thu, 18 Jun 2020 13:35:03 -0700
Subject: [PATCH 3/3] jsdoc update
---
.../WorkItem/setForwardMessageModalDialogModalStateAction.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js
index a1b4c8d81cc..11e778026c4 100644
--- a/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js
+++ b/web-client/src/presenter/actions/WorkItem/setForwardMessageModalDialogModalStateAction.js
@@ -4,7 +4,8 @@ import { state } from 'cerebral';
* set the modal state
*
* @param {object} providers the providers object
- * @param {object} providers.store the cerebral store function
+ * @param {Function} providers.get the cerebral get function
+ * @param {object} providers.store the cerebral store
*/
export const setForwardMessageModalDialogModalStateAction = ({
get,