Commit 69dff49
committed
Merge branch 'bugfix/HierarchicalTopicMappingService-model-validation' into develop
The `HierarchicalTopicMappingService`'s `GetRootViewModelAsync()` and `GetViewModelAsync()` methods accept a `validationDelegate' for determining if each individual topic should be added to the mapped hierarchy.
Except that's not how it was actually working. Due to a bug in where the `validationDelegate` was called, it was effectively validating the parent topic—but only after that parent topic had already been mapped. This still allowed it to bypass mapping all children, but prevented it from being used to prune individual children based on their individual attributes, which is the far more intuitive and expected behavior—and also the behavior indicated by the documentation.
This fixes that bug, and also updates the logic of the one implementation which specifies a `validationDelegate` to ensure it's compatible with the new placement. (Fortunately, we have visibility into all other implementations, and `validationDelegate` isn't otherwise called; as such, we can be confident this won't break other implementations that worked around this bug by accommodating its incorrect behavior.)
While I was at it, I also updated `MenuViewComponentBase<T>` to filter out `List` content types—something traditionally done in the view—as there's no expected scenario where we'd want nested topic lists to show up in the main navigation, since a) they're not routable by `TopicController`, and b) intended to represent internal page content, not part of the site hierarchy.2 files changed
Lines changed: 3 additions & 3 deletions
File tree
- OnTopic.AspNetCore.Mvc/Components
- OnTopic/Mapping/Hierarchical
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
0 commit comments