Fix items_behind error when moving a change
When moving an item, we correctly reparented the items behind
the item to the item that was previously ahead. But we did
not remove the references to the items behind from the item
that was being moved. This could result in that item
maintaining references to items that were previously behind it.
Generally, these would be the same and it would manifest as
double entries in items_behind.
Change-Id: Ibc1447867df4c6fc7b4fe954770a06c7c24fadc4
diff --git a/zuul/model.py b/zuul/model.py
index 2d0f256..056f41d 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -435,6 +435,7 @@
item_behind.item_ahead = item.item_ahead
# Add to new location
item.item_ahead = item_ahead
+ item.items_behind = []
if item.item_ahead:
item.item_ahead.items_behind.append(item)
return True