CATcher-org / CATcher-org/CATcher
Reduce code duplication in `bug reporting`, `team response` and `tester response` views
- Dominant language
- TypeScript
- Stars
- 92
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
As [suggested](https://github.com/CATcher-org/CATcher/pull/984#pullrequestreview-1134105253) by @gycgabriel, we can reduce the duplication in the code that checks if a user has made any changes to the issue or response while in edit mode.
### Context
This feature was introduced in the following PRs:
- #985
- #984
This was done to ensure that the when the user leaves edit mode, the cancel edit warning dialog box (that warns the user that some changes made will be discarded) is only shown if he/she has actually made any changes to the issue or response.
### Where the code duplication is
The method to detect changes `openCancelDialogIfModified` is currently declared in 4 separate components (shown below):
https://github.com/CATcher-org/CATcher/blob/660e01726df9c5a499c4d320cb75f8393bb486b8/src/app/shared/issue/title/title.component.ts#L83-L92
https://github.com/CATcher-org/CATcher/blob/660e01726df9c5a499c4d320cb75f8393bb486b8/src/app/shared/issue/description/description.component.ts#L121-L130
https://github.com/CATcher-org/CATcher/blob/660e01726df9c5a499c4d320cb75f8393bb486b8/src/app/shared/view-issue/team-response/team-response.component.ts#L151-L161
https://github.com/CATcher-org/CATcher/blob/660e01726df9c5a499c4d320cb75f8393bb486b8/src/app/shared/view-issue/tester-response/tester-response.component.ts#L142-L172
### What can be done
There is an opportunity to reduce code duplication, possibly by moving this function into a service.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.