Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate if we can/should handle Attachment links/Work Item links in a more general fashion #1064

Open
Alexander-Hjelm opened this issue Sep 13, 2024 · 1 comment

Comments

@Alexander-Hjelm
Copy link
Collaborator

Alexander-Hjelm commented Sep 13, 2024

Following up on #1063

Here is the CorrectDescription method for reference:

public bool CorrectDescription(WorkItem wi, WiItem wiItem, WiRevision rev, IsAttachmentMigratedDelegate<string, string, bool> isAttachmentMigratedDelegate)
{
if (wi == null)
{
throw new ArgumentException(nameof(wi));
}
if (wiItem == null)
{
throw new ArgumentException(nameof(wiItem));
}
if (rev == null)
{
throw new ArgumentException(nameof(rev));
}
string description = wi.Fields[WiFieldReference.WorkItemType].ToString() == "Bug" ? wi.Fields[WiFieldReference.ReproSteps].ToString() : wi.Fields[WiFieldReference.Description].ToString();
if (string.IsNullOrWhiteSpace(description))
return false;
bool descUpdated = false;
CorrectImagePath(wi, wiItem, rev, ref description, ref descUpdated, isAttachmentMigratedDelegate);
if (descUpdated)
{
if (wi.Fields[WiFieldReference.WorkItemType].ToString() == "Bug")
{
wi.Fields[WiFieldReference.ReproSteps] = description;
}
else
{
wi.Fields[WiFieldReference.Description] = description;
}
}
return descUpdated;
}

You can see that the description field seems to be hard coded for various Work Item Types. If the WI Type name is "Bug", then it seems to switch over to using ReproSteps instead of Description. This causes issues if there are any other HTML fields than Description/Bug. Is there an existing way to handle custom HTML fields, or does this feature need to be built?

@Alexander-Hjelm Alexander-Hjelm changed the title Investigate if we can/should handle Attachmen links/Work Item links in a more general fashion Investigate if we can/should handle Attachment links/Work Item links in a more general fashion Sep 13, 2024
@cacti77
Copy link

cacti77 commented Sep 16, 2024

My suggestion would simply be to respect the mapping between the types and fields specified by the user in their config json file, rather than simply assume certain WITs use certain fields. I was forced to migrate from Jira to ADO at short notice and had little knowledge of the ADO WITs and their standard field names (e.g., that Bugs used Repro Steps rather than Description; see #1063). If instead you do want to assume specific field types in target WITs then this ought to be clearly documented somewhere.

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

No branches or pull requests

2 participants