Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Recently Updated macro is not filtering properly on spaces #165

Closed
aubincleme opened this issue Oct 10, 2023 · 5 comments
Closed

The Recently Updated macro is not filtering properly on spaces #165

aubincleme opened this issue Oct 10, 2023 · 5 comments

Comments

@aubincleme
Copy link
Member

Steps to reproduce :

  • In a blank wiki, import the tree of pages that can be found in this XAR : https://up1.xwikisas.com/#hdhXEly45C0VXOEhRZP4Dw
  • Head to Test Space.WebHome
  • Observe that the recently updated macro shows updates from pages that are part of Test Space 2 and not part of Test Space.

This is unexpected as the recently updated macro should filter by default on the recent updates of the space it is currently defined in.

@aubincleme
Copy link
Member Author

aubincleme commented Oct 10, 2023

I tired adding the following code in #queryPages of Confluence.Macros.RecentlyUpdatedService, which seems to sort of resolve the issue, but needs to be integrated further into the service :

  #if ("$!options.spaces" != '')
    ## Note : this is only splitting the list of spaces based on the comma separator, however the documentation of the Recently Updated macro in Confluence DC specifies that spaces could also be separated per space. This would be causing an issue in XWiki because spaces can contain space chars in their name. See https://confluence.atlassian.com/doc/recently-updated-macro-139519.html
    #foreach($space in $options.spaces.split(','))
      #if ($foreach.count == 1)
        #set($spaceSelector = "${escapetool.q}$!{space}${escapetool.q}")
      #else
        #set($spaceSelector = "$!{spaceSelector} OR ${escapetool.q}$!{space}${escapetool.q}")
      #end
    #end
    <h1>Got spaces : $!{spaceSelector}</h1>
    #set ($discard = $fq.add("space_prefix:($!{spaceSelector})"))
  #end

raphj added a commit that referenced this issue Oct 11, 2023
Co-authored-by: Clément Aubin <clement.aubin@xwiki.com>
raphj added a commit that referenced this issue Oct 11, 2023
Co-authored-by: Clément Aubin <clement.aubin@xwiki.com>
@raphj
Copy link
Contributor

raphj commented Oct 11, 2023

I integrated and tested your code. it seems to work well.

I would add the space (' ') to the split regex if we knew people only used the recently updated macro from a confluence migration.

@raphj raphj self-assigned this Oct 11, 2023
@aubincleme
Copy link
Member Author

aubincleme commented Oct 11, 2023 via email

@raphj
Copy link
Contributor

raphj commented Oct 12, 2023

Indeed, we could add it, but it could be exposed as a parameter disabled by
default

I'll open a new ticket for this so we can discuss it further. The issue I have with disabled by default is that it might still break confluence migrations. Unless we can add a parameter from the confluence migrator.

@raphj
Copy link
Contributor

raphj commented Oct 12, 2023

#167

@raphj raphj closed this as completed Oct 20, 2023
@raphj raphj added this to the 1.10.1 milestone Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants