This issue has been created
There is 1 update.
 
 
Blog Application / cid:jira-generated-image-avatar-1a99fbe3-8889-4f6d-b3b1-e14ce61de869 BLOG-274 Open

Renaming a blog category stores its parent with the wiki prefix

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f3ba535c-c913-477e-a513-fe224a0bd1e8 Vincent Massol created this issue on 14/Oct/26 12:12
 
Summary: Renaming a blog category stores its parent with the wiki prefix
Issue Type: cid:jira-generated-image-avatar-1a99fbe3-8889-4f6d-b3b1-e14ce61de869 Bug
Affects Versions: 9.15.14
Assignee: Unassigned
Created: 14/Oct/26 12:12
Priority: cid:jira-generated-image-static-major-09e099b4-a50c-4074-a051-24a3ce7ecdbc Major
Reporter: Vincent Massol
Description:

When a blog category is renamed, CategoryRenameListener restores the parent the category had before the rename. It restores it as an absolute reference, so the parent is now stored as xwiki:Blog.Categories.Parent instead of Blog.Categories.Parent.

The category pages look for the subcategories of a category by comparing the stored parent with the local name of the category (doc.parent = :category in #renameCategory and #deleteCategory, Blog.CategoriesCode), as does the category location migration. A category that was renamed once is therefore no longer found as a subcategory of its parent.

Steps to reproduce

  1. Create a category Parent and a subcategory Child of it
  2. Rename Child to Child2 (page rename)
  3. Rename Parent to Parent2 from Blog.ManageCategories, or delete it

Expected: Child2 is a subcategory of Parent2 (or of the parent of the deleted category)
Actual: the parent of Child2 is not updated and still points to Parent, which doesn't exist anymore

Cause

CategoryRenameListener.java:117 keeps XWikiDocument#getParentReference(), which is always absolute, and CategoryRenameListener.java:141 sets it back as is. XWikiDocument#getParent(), which is what is saved in the database, then serializes it with the wiki. The relative parent (getRelativeParentReference()) should be kept instead.

The current behaviour is pinned by CategoryRenameListenerTest#renamingACategoryKeepsItsParent (BLOG-269).

 
 

1 update

 
cid:jira-generated-image-avatar-f3ba535c-c913-477e-a513-fe224a0bd1e8 Changes by Vincent Massol on 14/Oct/26 12:12
 
Assignee: Vincent Massol