Repository navigation
KB API: admin create/update/delete for articles and categories, in v1.0 (#1948 reconciled) - #1953
Merged
Merged
Conversation
A new entriesv1_1.php would have become the default for every unversioned /api/kb call -- the loader picks the highest version it finds -- so the consumer of #1942's public feed would have moved onto it unasked, and the two files carried the same list/read code twice. The write tasks and the categories endpoint now live in v1.0; list and read behave exactly as before for every caller unless a Super User asks for a state, and a Super User may read an unpublished article. Fixes on the way in: - deleting a category with grandchildren corrupted the nested set: Nested::destroy() closes the gap once per level and again for the stale descendant models it holds. Rows now go deepest first, each a leaf when it does, followed by a rebuild of the shared tree - a posted category alias was stored as sent on update (the model only derives one on create); it is normalised, and an empty one falls back to the title - the alias clash check matched the site's routing: any category of the extension, not siblings of any extension - a JSON body could name another id, or another task, and redirect the request; route variables are no longer taken from the body - state, access, created and created_by are validated before saving - comments described language loading and model includes the code did not do Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #1948 (head on a fork). denphi's commit rebased onto 2.4-main, then a second commit that folds the new write operations into
entriesv1_0.phpinstead of addingentriesv1_1.php:Why one version.
Hubzero\Api\Component\Loaderserves the highestentriesv*.phpfor unversioned calls, so v1.1 would have silently replaced v1.0 for the consumer of #1942's public feed, and the two files duplicated ~300 lines of list/read code. In the merged controllerlistandreadbehave exactly as before for every caller; the only additions are for Super Users (state=0|1|2|allon list, reading an unpublished article), plus atagsfield on read.Review fixes applied.
Nested::destroy()corruptslft/rgtwhen the subtree has grandchildren (gap closed once per level and again for stale models). Rows are now destroyed deepest-first, each a leaf at the time, then the shared tree is rebuilt.com_kb/site/router.php, which resolves categories by bare alias.id/task/controller/… are no longer merged into the request, so a body cannot retarget the route.state,access,created,created_byvalidated (422 with specific messages).Not changed: moves still use
saveAsChildOf()+rebuild(1), as the admin save does.🤖 Generated with Claude Code