-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix project status change on update for archived projects (#438)
Before, updating some field (i.e. `Description`) of an `Archived` project causes the project state to change to `Active`. This is caused by a bug in the `updateProjectsFunc` function used for the `update` command. During project updates, `edited`, a default project created based on the given configs/flags, comes with `admin.Project_ACTIVE` state by default if both `activate` and `archive` flags have not been set. Then a `copy` of the target project will be updated based on `edited` and then used for showing the diff. In the current implementation, the state of the `copy` is set to be the same as `edited` projects state, which is `Project_ACTIVE` if no flags are set. Also, after showing the diff, the `edited` is used for updating the project. Since it comes with `Project_ACTIVE` state by default, the target project will be updated to have `Project_ACTIVE` if both `activate` and `archive` flags are unset, regardless of the projects previous state. On this PR, we make sure we set the correct state to both `copy` and `edited` by checking if both `activate` and `archive` flags are set/unset. If one of the flags are set, we update target project state (`copy`) based on the `edited` state since it will have the desired state. If both flags are unset, we set the `edited` state to be the same as target (`copy`) state. This way, updating `archived` projects will not change their state. Signed-off-by: mcanueste <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters