This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-bbac14c8-ee3e-4acb-8dd2-70df7696b034 XWIKI-25786 Open

Wiki macros with the same id defined in several pages should be stacked instead of overwritten

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-23b003c3-bcc8-4b14-9ed9-ca5c867f63e3 Vincent Massol created this issue on 17/Nov/26 14:39
 
Summary: Wiki macros with the same id defined in several pages should be stacked instead of overwritten
Issue Type: cid:jira-generated-image-avatar-bbac14c8-ee3e-4acb-8dd2-70df7696b034 Improvement
Affects Versions: 17.10.0
Assignee: Unassigned
Components: Rendering - WikiMacro
Created: 17/Nov/26 14:39
Priority: cid:jira-generated-image-static-major-35a1fcd1-1811-4f3c-99ff-8d0815c94cdf Major
Reporter: Vincent Massol
Description:

Problem

When several pages define a wiki macro with the same id and the same visibility (e.g. a page holding a wiki macro copied as a template, then modified), the last registered one overwrites the others. Deleting the page of the winning macro, or removing its macro object, then leaves no macro at all ("Unknown macro") even though other pages still define it, until the wiki is restarted.

Expected

With XCOMMONS-85, the component manager keeps all the components registered with the same role and hint: the one with the best priority is used (the last registered one in case of same priority) and the other ones are hidden until it's unregistered. Wiki macros should benefit from it: removing the macro of one page should make the macro defined in another page with the same id available again.

What needs to change in DefaultWikiMacroManager

  • Unregister the macro by its descriptor and instance (ComponentManager#unregisterComponent(ComponentDescriptor, Object), new in XCOMMONS-85) instead of by role type and hint, which removes all the macros registered with that id, including the ones of other pages.
  • Unregister the previous macro of the same document (known from wikiMacroMap) before registering it again. Wiki macros are registered again without being unregistered first, e.g. for all the wiki macros on each XAR import (RegisterMacrosOnImportListener). With stacking, each of these registrations would otherwise keep the previous instance hidden in the component manager.

Both changes have to go together, and have to be released with XCOMMONS-85.

 
 

2 updates

 
cid:jira-generated-image-avatar-23b003c3-bcc8-4b14-9ed9-ca5c867f63e3 Changes by Vincent Massol on 17/Nov/26 14:39
 
Fix Version: 18.10.0-rc-1
Assignee: Vincent Massol