Skip to content

Commit

Permalink
fix overzealous label state mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
chriku committed Sep 17, 2024
1 parent 6eed297 commit 069c118
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions sync/src/main/kotlin/gropius/sync/AbstractSync.kt
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,20 @@ abstract class AbstractSync(
mappedStates: List<IssueState>
) {
val labelStateMap = this.labelStateMap(imsProject)
timelineItems.remove(timelineItem)
val newStateChange = StateChangedEvent(
timelineItem.createdAt, timelineItem.lastModifiedAt
)
newStateChange.oldState().value = lastState
newStateChange.newState().value = mappedStates.firstOrNull() ?: lastState//TODO("Restore State out of nothing")
newStateChange.createdBy().value = timelineItem.createdBy().value
newStateChange.lastModifiedBy().value = timelineItem.lastModifiedBy().value
timelineItems.add(newStateChange)
issue.timelineItems().add(newStateChange)
val mappedState = lookupState(labelStateMap[timelineItem.removedLabel().value?.name])
if ((mappedState != null) && !mappedStates.contains(mappedState)) {
timelineItems.remove(timelineItem)
val newStateChange = StateChangedEvent(
timelineItem.createdAt, timelineItem.lastModifiedAt
)
newStateChange.oldState().value = lastState
newStateChange.newState().value =
mappedStates.firstOrNull() ?: lastState//TODO("Restore State out of nothing")
newStateChange.createdBy().value = timelineItem.createdBy().value
newStateChange.lastModifiedBy().value = timelineItem.lastModifiedBy().value
timelineItems.add(newStateChange)
issue.timelineItems().add(newStateChange)
}
}

/**
Expand Down

0 comments on commit 069c118

Please sign in to comment.