Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Change type of a workitem #2187

Closed
DhritiShikhar opened this issue Jul 26, 2018 · 5 comments
Closed

Change type of a workitem #2187

DhritiShikhar opened this issue Jul 26, 2018 · 5 comments
Assignees

Comments

@DhritiShikhar
Copy link
Contributor

DhritiShikhar commented Jul 26, 2018

As per discussion with @kwk and @jarifibrahim

Description

Implement the backend support for changing the type of a workitem.

Steps

  1. To change workitemtype of a workitem, send a PATCH request to the workitem:

  2. Check if the user is allowed to change the workitem. Only creator and space owner can change the type as of now.

  3. Iterate over the fields of original workitem.

Case 1

Both original workitem and new workitem have the same field name and field type. In this case, the data is retained.

Case 2

New workitem has a field which original workitem does not have. In this case, the new workitem gets empty value (or default values; refer #2160).

Case 3

Original workitem has an extra field which the new workitem does not have. To preserve the data, we simply append the data to description field of workitem.

Audit Trail

Audit Trail should contain a record of change of work item type.

@sbose78
Copy link
Member

sbose78 commented Jul 26, 2018

Sounds like a plan!

@jarifibrahim
Copy link
Member

Here's how the migration of workitem from Type A to Type B will be performed.

  1. At the controller level, check if the update is a type update. If so, check if the user is space owner or workitem creator.
  2. Perform Migration if user is authorized to do so at the repository level
    1. Find the diff of fields in Type A and Type B. Remove the diff from Type A.
    2. The resultant set of fields in Type A is a subset of fields in Type B. Update all matching fields in Type A and Type B with values of Type A.
    3. Append the diff (with field name and type) to the Description of the workitem

@jarifibrahim
Copy link
Member

Consider the following topology
Epic -> Story -> Task
When the user changes Epic to Bug, we will have Bug -> Story -> Task .This is a possible side effect of the type change.

@kwk
Copy link
Collaborator

kwk commented Jul 31, 2018

Consider the following topology
Epic -> Story -> Task
When the user changes Epic to Bug, we will have Bug -> Story -> Task .This is a possible side effect of the type change.

@jarifibrahim yes, this is expected.

@jarifibrahim
Copy link
Member

Fixed via #2202

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants