Skip to content

Commit

Permalink
Fixed bug where we weren't updating the edit
Browse files Browse the repository at this point in the history
  • Loading branch information
cdanwards committed May 14, 2023
1 parent 9586b14 commit 24115ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
15 changes: 3 additions & 12 deletions src/pages/home/TaskHeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ function TaskHeaderView(props) {
icons={assignee.icons}
text={assignee.displayName}
alternateText={assignee.subtitle}
onPress={() => {
TaskUtils.beginEditingTask();
Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID));
}}
onPress={() => Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))}
label="taskReport.to"
isNewTask={false}
/>
Expand All @@ -75,18 +72,12 @@ function TaskHeaderView(props) {
shouldShowHeaderTitle
title={props.report.reportName}
description="Task"
onPress={() => {
TaskUtils.beginEditingTask();
Navigation.navigate(ROUTES.getTaskReportTitleRoute(props.report.reportID));
}}
onPress={() => Navigation.navigate(ROUTES.getTaskReportTitleRoute(props.report.reportID))}
/>
<MenuItemWithTopDescription
title={lodashGet(props.report, 'description', '')}
description="Description"
onPress={() => {
TaskUtils.beginEditingTask(props.report);
Navigation.navigate(ROUTES.getTaskReportDescriptionRoute(props.report.reportID));
}}
onPress={() => Navigation.navigate(ROUTES.getTaskReportDescriptionRoute(props.report.reportID))}
/>
</>
);
Expand Down
23 changes: 12 additions & 11 deletions src/pages/tasks/TaskAssigneeSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const propTypes = {
route: PropTypes.shape({
/** Params from the URL path */
params: PropTypes.shape({
/** taskReportID passed via route: /r/:taskReportID/title */
taskReportID: PropTypes.string,
/** reportID passed via route: /r/:reportID/title */
reportID: PropTypes.string,
}),
}),

Expand Down Expand Up @@ -154,18 +154,19 @@ const TaskAssigneeSelectorModal = (props) => {
return;
}

// Check to see if we're editing a task and if so, update the assignee
if (props.task.report === props.route.params.taskReportID) {
// Pass through the selected assignee
TaskUtils.editTaskAndNavigate(props.task.report, props.session.email, '', '', option.alternateText);
}

// Otherwise, we're creating a new task
if (option.alternateText) {
// Check to see if we're creating a new task
// If there's no route params, we're creating a new task
if (!props.route.params && option.alternateText) {
// Clear out the state value, set the assignee and navigate back to the NewTaskPage
setSearchValue('');
TaskUtils.setAssigneeValue(option.alternateText, props.task.shareDestination);
Navigation.goBack();
return Navigation.goBack();
}

// Check to see if we're editing a task and if so, update the assignee
if (props.route.params.reportID && props.task.report.reportID === props.route.params.reportID) {
// Pass through the selected assignee
TaskUtils.editTaskAndNavigate(props.task.report, props.session.email, '', '', option.alternateText);
}
};

Expand Down

0 comments on commit 24115ef

Please sign in to comment.