Skip to content

Commit

Permalink
Merge pull request #757 from digirati-co-uk/MAD-1293/feature/delete-t…
Browse files Browse the repository at this point in the history
…asks-with-contributions

delete all tasks when removing all contributions
  • Loading branch information
stephenwf committed Aug 23, 2023
2 parents a9856ae + 374960c commit 630a0aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ Hotfix release for submissions in progress.

### Changed
- Changed language on user dash from 'reviews' to 'review tasks' to differentiate between the two
- Improved 'delete all contributions' by deleting all user tasks as well as capture model
- Changed the project heading block to contain optional image and start contributing button


## [v2.1.0](https://github.com/digirati-co-uk/madoc-platform/compare/v2.0.8...v2.1.0)

This is a larger release and include changes to bring Madoc inline with Canvas Panel and Manifest Editor, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const CanvasTaskProgress: React.FC = () => {
const { data: canvasModel, refetch: refetchModel } = useCanvasModel();

const canvasTask = projectTasks?.canvasTask;
const userTasks = projectTasks?.userTasks;
const isManifestComplete = projectTasks?.isManifestComplete;
const canBeMarkedAsComplete = !canvasTask || canvasTask.status <= 1;
const totalContributors = projectTasks?.totalContributors;
Expand Down Expand Up @@ -83,7 +84,18 @@ export const CanvasTaskProgress: React.FC = () => {
});

const [deleteCaptureModel, deleteCaptureModelStatus] = useMutation(async () => {
if (canvasModel && canvasModel.model && canvasModel.model.id) {
if (canvasModel && canvasModel.model && canvasModel.model.id && userTasks) {
await Promise.all(
userTasks.map(
userTask =>
userTask &&
userTask.id &&
api.deleteTask(userTask.id).catch(err => {
console.log(err);
})
)
);

await api.deleteCaptureModel(canvasModel.model.id);
await refetchModel();
}
Expand Down
1 change: 1 addition & 0 deletions services/madoc-ts/translations/en/madoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@
"This manifest is not available to browse": "This manifest is not available to browse",
"This merge may be corrupted": "This merge may be corrupted. Would you like to remove it?",
"This page is complete": "This page is complete",
"This task is complete.": "This task is complete.",
"This task is complete. You can make another contribution from the": "This task is complete. You can make another contribution from the",
"This tasks parent is complete, you can no longer edit or submit this task": "This tasks parent is complete, you can no longer edit or submit this task",
"Thumbnail background": "Thumbnail background",
Expand Down

0 comments on commit 630a0aa

Please sign in to comment.