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

Branch to fix attachments #892

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/WorkItemMigrator/JiraExport/JiraItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ private static void HandleAttachmentChange(JiraChangeItem item, List<RevisionAct

if (UndoAttachmentChange(attachmentChange, attachments))
{
attachmentChanges.Add(attachmentChange);
Logger.Log(LogLevel.Debug, $"Attachment {item.ToString ?? item.FromString} cannot be migrated because it was deleted.");
}
else
{
Logger.Log(LogLevel.Debug, $"Attachment {item.ToString ?? item.FromString} cannot be migrated because it was deleted.");
attachmentChanges.Add(attachmentChange);
}
}

Expand Down Expand Up @@ -241,10 +241,10 @@ private static bool UndoAttachmentChange(RevisionAction<JiraAttachment> attachme
{
if (attachmentChange.ChangeType == RevisionChangeType.Removed)
{
Logger.Log(LogLevel.Debug, $"Skipping undo for attachment '{attachmentChange.ToString()}'.");
return false;
return RemoveAttachment(attachmentChange, attachments);
}
return RemoveAttachment(attachmentChange, attachments);
Logger.Log(LogLevel.Debug, $"Skipping undo for attachment '{attachmentChange.ToString()}'.");
return false;
}

private static bool RemoveAttachment(RevisionAction<JiraAttachment> attachmentChange, List<JiraAttachment> attachments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void When_an_attachment_is_added_and_removed_Then_it_cannot_be_migrated_a
Assert.Multiple(() =>
{
Assert.AreEqual(3, jiraItem.Revisions.Count);
Assert.IsTrue(jiraItem.Revisions.All(r => r.AttachmentActions.Count == 0));
Assert.IsFalse(jiraItem.Revisions.All(r => r.AttachmentActions.Count == 0));
});
}

Expand Down
Loading