-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Bug: Unable to move first child after a sibling #76
Comments
This does not appear to be specific to the OnTopic Editor, and instead appears to be an issue with the underlying |
There’s an escape clause at the start of If the sibling isn’t in the collection, it’s index will be -1; if the source is the first topic—as it will be if it’s the only topic—then it will have an index of 0. As these are one apart, it mistakenly interprets this as them already being siblings. Adding an explicit check to validate their parent’s are the same will mitigate this issue, as would confirming that the sibling’s location isn’t less than zero. The former is the simplest approach. |
The escape clause at the top of `Move()` prevents further processing of the request if the topic is being moved to the same position it is already at. There was a bug in this, however, where it failed to check if the `target` was the same as the `topic.Parent`. That works fine so long as the `topic` and the `sibling` are, indeed, in the same collection. But if they're not, and the `topic` is in the first position, this will lead to a false positive. In effect, this prevents the first topic from being moved after a sibling in another collection. This is easily fixed by limiting the escape clause to cases where the current parent is the same as the `target` parent. This resolves #76, though we'll want to validate this via some unit tests.
Fixed a bug where moving the first (or only) child of a topic to after a sibling in another topic would be inadvertently trip an escape condition meant to bypass cases where the topic was being moved to the same location that it was already located. As part of this, introduced two unit tests—one to validate that the bug no longer appears, and another to ensure that the escape condition still works. This resolves Issue #76.
This was fixed by simply checking that the |
OnTopic 5.1.0 is a minor release which introduces support for mapping constructor parameters (#35) and defining what model to use when mapping associations via the `[MapAs()]` attribute (#41). Primarily, however, it is focused on bug fixes, and resolves a number of priority issues, such as an exception which occurs when deleting topics with associations (#47), topics with deleted references being treated as _unresolved_ (#46), and the inability to move a first child to another parent (#76). Finally, it also includes a number of improvements, such as checking type compatibility before mapping an association (#83), migrating the unit tests to xUnit.net (#66), and establishing integration tests for ASP.NET Core (#39). For a full rollup of new features, improvements, and bug fixes, see Pull Request #85.
If a topic is the only child of its parent topic, it is unable to be moved after a sibling in another topic. If there are more than one topic in the parent topic, or it is moved to be the first child of the target topic, then it can be moved without any problems.
The text was updated successfully, but these errors were encountered: