Skip to content

Commit

Permalink
Merge branch 'feature/APPEALS-34965'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-KRedd committed Oct 1, 2024
2 parents e396fb9 + 24a4e18 commit 0d3b1ba
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,16 @@ class WorkQueue::CorrespondenceAppealsSerializer
object.appeal.issues.length
end

attribute :appeal do |object|
WorkQueue::AppealSerializer.new(object.appeal, params: { user: RequestStore[:current_user] })
end

attribute :task_added_data do |object|
tasks = []
object.correspondences_appeals_tasks.each do |cor_app_task|
assigned_to = cor_app_task.task.assigned_to
assigned_to_text = assigned_to.is_a?(Organization) ? assigned_to.name : assigned_to.css_id
task_data = {
assigned_at: cor_app_task.task.assigned_at,
assigned_to: assigned_to_text,
assigned_to_type: cor_app_task.task.assigned_to_type,
instructions: cor_app_task.task.instructions,
type: cor_app_task.task.label
}
tasks << task_data
end
tasks
AmaAndLegacyTaskSerializer.create_and_preload_legacy_appeals(
params: { user: RequestStore[:current_user], role: "generic" },
tasks: object.tasks,
ama_serializer: WorkQueue::TaskSerializer
).call
end

attribute :status do |object|
Expand Down
6 changes: 0 additions & 6 deletions client/app/queue/QueueApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1017,12 +1017,6 @@ class QueueApp extends React.PureComponent {
title={`${PAGE_TITLES.USER_MANAGEMENT} | Caseflow`}
render={this.routedUserManagement}
/>
<PageRoute
path="/queue/correspondence/:correspondence_uuid/intake"
title={`${PAGE_TITLES.USER_MANAGEMENT} | Caseflow`}
render={this.routedCorrespondenceIntake}
/>

<PageRoute
path="/queue/correspondence/:correspondence_uuid/intake"
title={`${PAGE_TITLES.CORRESPONDENCE_INTAKE}`}
Expand Down
2 changes: 1 addition & 1 deletion client/app/queue/components/QueueOrganizationDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class QueueOrganizationDropdown extends React.Component {

const organizationItems = organizations.map((org, index) => {
// If the url is a specified path, use it over the organization route
const orgHref = org.url.includes('/') ? org.url : `/organizations/${org.url}`;
const orgHref = org.url?.includes('/') ? org.url : `/organizations/${org.url}`;

const label = correspondenceTable(org) ?
org.name : sprintf(COPY.CASE_LIST_TABLE_QUEUE_DROPDOWN_TEAM_CASES_LABEL, org.name);
Expand Down
1 change: 1 addition & 0 deletions client/app/queue/components/TaskRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ class TaskRows extends React.PureComponent {
eventsFromAppeal
);


return (
<React.Fragment key={appeal.externalId}>
{sortedTimelineEvents.map((timelineEvent, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ import React from 'react';
import PropTypes from 'prop-types';
import CaseDetailsLink from '../CaseDetailsLink';
import DocketTypeBadge from '../../components/DocketTypeBadge';
import CorrespondenceCaseTimeline from './CorrespondenceCaseTimeline';
import { appealWithDetailSelector, taskSnapshotTasksForAppeal } from '../selectors';
import { useSelector } from 'react-redux';
import TaskRows from '../components/TaskRows';

const CorrespondenceTasksAdded = (props) => {
const CorrespondenceAppealTasks = (props) => {
const veteranFullName = props.correspondence.veteranFullName;
const appealId = props.appeal.external_id;
const appeal = useSelector((state) =>
appealWithDetailSelector(state, { appealId })
);

const tasks = useSelector((state) =>
taskSnapshotTasksForAppeal(state, { appealId })
);

return (
<>
Expand Down Expand Up @@ -46,15 +56,15 @@ const CorrespondenceTasksAdded = (props) => {
<p>{props.task_added.assignedTo ? props.task_added.assignedTo.name : ''}</p>
</div>

</div >
</div>
<div className="tasks-added-details">
<span className="tasks-added-text">Tasks added to appeal</span>
<div >
<CorrespondenceCaseTimeline
organizations={props.organizations}
userCssId={props.userCssId}
correspondence={props.task_added.correspondence}
tasksToDisplay={(props.task_added.taskAddedData)}
<div>
<TaskRows appeal={appeal}
taskList={tasks}
timeline={false}
editNodDateEnabled={false}
hideDropdown
/>
</div>
</div>
Expand All @@ -63,11 +73,12 @@ const CorrespondenceTasksAdded = (props) => {
);
};

CorrespondenceTasksAdded.propTypes = {
CorrespondenceAppealTasks.propTypes = {
correspondence: PropTypes.object,
task_added: PropTypes.object,
organizations: PropTypes.array,
userCssId: PropTypes.string,
appeal: PropTypes.object
};

export default CorrespondenceTasksAdded;
export default CorrespondenceAppealTasks;
18 changes: 11 additions & 7 deletions client/app/queue/correspondence/CorrespondenceTaskRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CorrespondenceTaskRows extends React.PureComponent {
this.state = {
taskInstructionsIsVisible: [],
showEditNodDateModal: false,
activeTasks: [props.taskList],
activeTasks: props.taskList,
};
}

Expand Down Expand Up @@ -95,12 +95,12 @@ class CorrespondenceTaskRows extends React.PureComponent {
};

taskInstructionsWithLineBreaks = (task) => {
if (!task.instructions || !task.instructions.length) {
if (!task.instructions || !task.instructions?.length) {
return <br />;
}

return (
<React.Fragment key={`${task.uniqueId} fragment`}>
<React.Fragment key={`${task.uniqueId} + ${task.instructions} fragment`}>
{task.instructions.map((text) => (
<div
key={`${task.uniqueId} instructions`}
Expand All @@ -113,6 +113,10 @@ class CorrespondenceTaskRows extends React.PureComponent {
};

taskInstructionsListItem = (task) => {
if (!task.instructions || !task.instructions?.length > 0) {
return null;
}

const taskInstructionsVisible = this.state.taskInstructionsIsVisible.includes(task.label);

return (
Expand Down Expand Up @@ -146,7 +150,7 @@ class CorrespondenceTaskRows extends React.PureComponent {
};

showActionsListItem = (task, correspondence) => {
if (task.availableActions.length <= 0) {
if (task.availableActions?.length === 0) {
return null;
}

Expand Down Expand Up @@ -187,7 +191,7 @@ class CorrespondenceTaskRows extends React.PureComponent {
const timelineTitle = isCancelled(task) ? `${task.type} cancelled` : task.timelineTitle;

return (
<tr key={task.uniqueId}>
<tr key={task.uniqueId + task.instructions}>
<td
className={timeline ? 'taskTimeTimelineContainerStyling' : 'taskTimeContainerStyling'}
role="cell"
Expand All @@ -201,8 +205,8 @@ class CorrespondenceTaskRows extends React.PureComponent {
<td className={tdClassNamesforCorrespondence(timeline, task)}>
{isCancelled(task) ? <CancelIcon /> : closedAtIcon(task, timeline)}

{((index < sortedTimelineEvents.length && timeline) ||
(index < this.state.activeTasks.length - 1 && !timeline)) && (
{((index < sortedTimelineEvents?.length && timeline) ||
(index < this.state.activeTasks?.length - 1 && !timeline)) && (
<div className={['grayLineStyling', cancelGrayTimeLineStyle(timeline)].join(' ')} />
)}
</td>
Expand Down
30 changes: 28 additions & 2 deletions client/app/queue/correspondence/details/CorrespondenceDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ import {
import CorrespondenceResponseLetters from './CorrespondenceResponseLetters';
import COPY from '../../../../COPY';
import CaseListTable from 'app/queue/CaseListTable';
import CorrespondenceTasksAdded from '../CorrespondenceTasksAdded';
import { prepareAppealForSearchStore, prepareAppealForStore, prepareTasksForStore } from 'app/queue/utils';
import { onReceiveTasks, onReceiveAppealDetails } from '../../QueueActions';
import moment from 'moment';
import Pagination from 'app/components/Pagination/Pagination';
import Table from 'app/components/Table';
import { ExternalLinkIcon } from 'app/components/icons/ExternalLinkIcon';
import { COLORS } from 'app/constants/AppConstants';
import Checkbox from 'app/components/Checkbox';
import CorrespondencePaginationWrapper from 'app/queue/correspondence/CorrespondencePaginationWrapper';

import Button from '../../../components/Button';
import Alert from '../../../components/Alert';
import ApiUtil from '../../../util/ApiUtil';
import CorrespondenceAppealTasks from '../CorrespondenceAppealTasks';

const CorrespondenceDetails = (props) => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -364,6 +367,28 @@ const CorrespondenceDetails = (props) => {
useEffect(() => {
dispatch(loadCorrespondence(correspondence));
dispatch(correspondenceInfo(correspondence));
// load appeals related to the correspondence into the store
const corAppealTasks = [];

props.correspondence.correspondenceAppeals.map((corAppeal) => {
dispatch(onReceiveAppealDetails(prepareAppealForStore([corAppeal.appeal.data])));

corAppeal.taskAddedData.data.map((taskData) => {
const formattedTask = {};

formattedTask[taskData.id] = taskData;

corAppealTasks.push(taskData);
});

});
// // load appeal tasks into the store
const preparedTasks = prepareTasksForStore(corAppealTasks);

dispatch(onReceiveTasks({
amaTasks: preparedTasks
}));

}, []);

const isTasksUnrelatedToAppealEmpty = () => {
Expand Down Expand Up @@ -438,11 +463,12 @@ const CorrespondenceDetails = (props) => {
</AppSegment>
)}
{(props.correspondence.correspondenceAppeals.map((taskAdded) =>
taskAdded.correspondencesAppealsTasks?.length > 0 && <CorrespondenceTasksAdded
<CorrespondenceAppealTasks
task_added={taskAdded}
correspondence={props.correspondence}
organizations={props.organizations}
userCssId={props.userCssId}
appeal={taskAdded.appeal.data.attributes}
/>
)
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ describe('CorrespondenceDetails', () => {

expect(document.getElementsByClassName('plus-symbol').length).toBe(1);
// Existing Appeals Table and Columns
fireEvent.click(existingAppealButton);
expect(screen.getByText('Existing Appeals')).toBeInTheDocument();
expect(screen.getByText('Appellant Name')).toBeInTheDocument();
expect(screen.getByText('Appeal Status')).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,19 @@

it "Verify #{task_action[:name]} task with Assign to team action dropdown" do

Check failure on line 76 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for Other motion tasks Verify Other motion task with Assign to team action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 76 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for FOIA request tasks Verify FOIA request task with Assign to team action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 76 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for CAVC Correspondence tasks Verify CAVC Correspondence task with Assign to team action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 76 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for Congressional interest tasks Verify Congressional interest task with Assign to team action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 76 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for Privacy act request tasks Verify Privacy act request task with Assign to team action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)
visit "/queue/correspondence/#{@correspondence.uuid}"
# find + dropdowns and click last one for tasks unrelated to appeal
dropdowns = page.all(".cf-btn-link")
dropdowns.last.click

click_dropdown(prompt: "Select an action", text: "Assign to team")
expect(page).to have_content("Assign Task")
expect(page).to have_content("Select a team")
click_dropdown(prompt: "Select or search", text: "Education")
find(".cf-form-textarea", match: :first).fill_in with: "Assign task instructions"
click_button "Assign-Task-button-id-1"
# find + dropdowns and click last one for tasks unrelated to appeal
dropdowns = page.all(".cf-btn-link")
dropdowns.last.click
expect(page).to have_content("#{task_action[:name]} task has been assigned to Education.")
expect(all(".cf-row-wrapper")[1].text).to include("Education")
expect(all(".cf-row-wrapper")[2].text).to include(task_action[:name].to_s)
Expand All @@ -90,12 +97,18 @@

it "Verify #{task_action[:name]} task with Change task type action dropdown" do

Check failure on line 98 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for Other motion tasks Verify Other motion task with Change task type action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 98 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for FOIA request tasks Verify FOIA request task with Change task type action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 98 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for CAVC Correspondence tasks Verify CAVC Correspondence task with Change task type action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 98 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for Congressional interest tasks Verify Congressional interest task with Change task type action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)

Check failure on line 98 in spec/feature/queue/correspondence/correspondence_details_task_actions_spec.rb

View workflow job for this annotation

GitHub Actions / caseflow_rspec_job (12, 8)

The Correspondence Details All Tasks Actions testing tasks actions for Privacy act request tasks Verify Privacy act request task with Change task type action dropdown Failure/Error: dropdowns.last.click Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: stale element not found in the current frame (Session info: chrome-headless-shell=127.0.6533.119)
visit "/queue/correspondence/#{@correspondence.uuid}"
# find + dropdowns and click last one for tasks unrelated to appeal
dropdowns = page.all(".cf-btn-link")
dropdowns.last.click
click_dropdown(prompt: "Select an action", text: "Change task type")
expect(page).to have_content("Change task type")
expect(page).to have_content("Select another task type from the list of available options:")
click_dropdown(prompt: "Select an action type", text: "CAVC Correspondence")
find(".cf-form-textarea", match: :first).fill_in with: "Change task type instructions"
click_button "Change-task-type-button-id-1"
# find + dropdowns and click last one for tasks unrelated to appeal
dropdowns = page.all(".cf-btn-link")
dropdowns.last.click
expect(page).to have_content("You have changed the task type from #{task_action[:name]} " \
"to CAVC Correspondence. These changes are now reflected in the tasks section below.")
expect(all(".cf-row-wrapper")[2].find("dd").text).to eq("CAVC Correspondence")
Expand Down
11 changes: 11 additions & 0 deletions spec/support/correspondece_task_actions_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,20 @@ def check_task_action(options = {})
expected_message = options[:expected_message]

visit "/queue/correspondence/#{correspondence.uuid}"
expect(page).to have_current_path("/queue/correspondence/#{correspondence.uuid}")

# find + dropdowns and click last one for tasks unrelated to appeal
dropdowns = page.all(".cf-btn-link")
dropdowns.last.click

click_dropdown(prompt: "Select an action", text: action)
find(".cf-form-textarea", match: :first).fill_in with: form_text
click_button button_id
expect(page).to have_current_path("/queue/correspondence/#{correspondence.uuid}")
# find + dropdowns and click last one for tasks unrelated to appeal
dropdowns = page.all(".cf-btn-link")
dropdowns.last.click

expect(page).to have_content("#{task_name} #{expected_message}")
end
end

0 comments on commit 0d3b1ba

Please sign in to comment.