Skip to content

Commit

Permalink
[preview] Bring images as well as links into scope (#2076)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHinsh authored Jun 2, 2024
2 parents 3874b5d + 9bd0a0a commit 77f61c2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ public class WorkItemPostProcessingContext : MigrationProcessorBase
{
private WorkItemPostProcessingConfig _config;
private TfsWorkItemEmbededLinkEnricher _workItemEmbeddedLinkEnricher;
private TfsEmbededImagesEnricher _workItemEmbededImagesEnricher;

public WorkItemPostProcessingContext(
IMigrationEngine engine,
IServiceProvider services,
ITelemetryLogger telemetry,
TfsWorkItemEmbededLinkEnricher workItemEmbeddedLinkEnricher,
TfsEmbededImagesEnricher embededImagesEnricher,
ILogger<WorkItemPostProcessingContext> logger)
: base(engine, services, telemetry, logger)
{
_workItemEmbeddedLinkEnricher = workItemEmbeddedLinkEnricher;
_workItemEmbededImagesEnricher = embededImagesEnricher;
}

public override string Name
Expand All @@ -59,7 +62,7 @@ protected override void InternalExecute()
//Builds the constraint part of the query
wiqb.Query = _config.WIQLQuery;

List<WorkItemData> sourceWIS = Engine.Target.WorkItems.GetWorkItems(wiqb);
List<WorkItemData> sourceWIS = Engine.Source.WorkItems.GetWorkItems(wiqb);
Log.LogInformation("Migrate {0} work items?", sourceWIS.Count);
//////////////////////////////////////////////////
ProjectData destProject = Engine.Target.WorkItems.GetProject();
Expand All @@ -84,11 +87,12 @@ protected override void InternalExecute()
TfsExtensions.ToWorkItem(targetFound).Open();
Engine.FieldMaps.ApplyFieldMappings(sourceWI, targetFound);
_workItemEmbeddedLinkEnricher.Enrich(null, targetFound);
_workItemEmbeddedLinkEnricher.Enrich(sourceWI, targetFound);
_workItemEmbededImagesEnricher.Enrich(sourceWI, targetFound);
if (TfsExtensions.ToWorkItem(targetFound).IsDirty)
{
try
{
targetFound.ToWorkItem().Fields["System.ChangedBy"].Value = "Migration";
TfsExtensions.SaveToAzureDevOps(targetFound);
Log.LogInformation(" Updated");
}
Expand Down

0 comments on commit 77f61c2

Please sign in to comment.