Skip to content

Commit dfe808f

Browse files
committed
Remove unnecessary and redundant topic.Parent setting
In the `Move()` action of the `EditorController`, the `topic.Parent` was explicitly being set to the new `target` parent. Not only is this unnecessary and redundant—since the underlying `ITopicRepository.Move()` will handle that—but it also introduces room for bugs since it will appear to `ITopicRepository` that the parent has not changed. I.e., if it compares `topic.Parent` to `target`, they will be the same, thus making it appear as a reordering, not a move. By not setting this in `EditorController`, we give `ITopicRepository` more reliable information, and centralize how this value is updated.
1 parent eec2f75 commit dfe808f

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

OnTopic.Editor.AspNetCore/Controllers/EditorController.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,6 @@ public IActionResult Move(int topicId, int targetTopicId = -1, int siblingId = -
491491
var topic = TopicRepository.Load(topicId);
492492
var target = (targetTopicId >= 0)? TopicRepository.Load(targetTopicId) : topic.Parent;
493493

494-
/*--------------------------------------------------------------------------------------------------------------------------
495-
| Reset the source topic's Parent
496-
\-------------------------------------------------------------------------------------------------------------------------*/
497-
topic.Parent = target;
498-
499494
/*--------------------------------------------------------------------------------------------------------------------------
500495
| Move the topic and/or reorder it with its siblings; lock the Topic repository prior to execution
501496
\-------------------------------------------------------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)