Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-18341

A wiki component based listener does not receive DocumentCreatingEvent when a user page is created

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 12.10.6, 13.3-rc-1
    • 4.2-milestone-3
    • Component
    • None
    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      I have a weird behavior on XWiki 10.11.9. I implemented an event listener on a wiki page, the listener listen to the event DocumentCreatingEvent.
      Apparently when a user page is created the DocumentCreatingEvent is not fired.

      Steps to reproduce :

      • Create an event listener on a wiki page, as explained on the documentation.
        • Create a page
        • Add a XWiki.ComponentClass XObject in it
          • Component Role Type: org.xwiki.observation.EventListener
          • Component Role Hint: mytestlistenr
          • Component Scope: Current Wiki
        • Add a XWiki.ComponentMethodClass XObject for implementing the getEvents() method:
          • Method Name: getEvents
          • Method body code:
            {{groovy}}
            import org.xwiki.bridge.event.*
            
            xcontext.method.output.value = [new DocumentCreatingEvent()]
            {{/groovy}}
            
        • Add another XWiki.ComponentMethodClass XObject for implementing the getName() method:
          • Method Name: getName
          • Method body code:
            {{groovy}}
            xcontext.method.output.value = "mytestlistenr"
            {{/groovy}}
            
        • Add another XWiki.ComponentMethodClass XObject for implementing the onEvent() method:
          • Method Name: onEvent
          • Method body
            {{groovy}}
            def logger = services.logging.getLogger('XWiki.Notifications.Code.UserNotificationsConfigurationListener')
            def document = xcontext.method.input.get(1)
            
            logger.warn("Creating document : {}", document);
            {{/groovy}}
            
      • Create a test page and check the logs, you will see that a warning is displayed on the logs, something like : 'Creating document : ...'
      • Go to the wiki administration, and on the users section create a new user, and observe the logs :
        • Actual result : nothing is displayed on the logs
        • Expected result : a new warning message is added to the logs, something like "Creating document : xxx" (xxx is the created user page reference)

      Note that I have the same issus concerning the DocumentCreatedEvent event.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            mouhb Mohamed Boussaa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: