-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
XWIKI-22155: Search suggest not working in private wikis #3117
Conversation
* Extract Velocity code from searchSuggest.js to XWiki.SearchSuggestCode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good, I'm wondering about a few things:
- Would it be possible to also replace the few remaining Velocity calls by using the JavaScript localization API? Then Velocity parsing could be disabled.
- Is creating a wiki page to get the JSON our best practice, in particular if we load them on every request? Also, most likely, the sources are only needed on very few page loads. I wonder if it would make sense to delay loading the sources until results shall actually be requested. This would improve performance, reduce data transfer, improve sustainability, ...
...wiki-platform-search/xwiki-platform-search-ui/src/main/resources/XWiki/SearchSuggestCode.xml
Show resolved
Hide resolved
...orm-core/xwiki-platform-search/xwiki-platform-search-webjar/src/main/webjar/searchSuggest.js
Outdated
Show resolved
Hide resolved
...orm-core/xwiki-platform-search/xwiki-platform-search-webjar/src/main/webjar/searchSuggest.js
Outdated
Show resolved
Hide resolved
* Remove all remaining Velocity code from searchSuggest.js * Improve security * Replace JQuery with fetch API
It made sense to me when I started considering that the list of available sources could be dynamic and tied to the user rights. I'm interested if you have other suggestions. |
I don't think the sources are actually tied to rights, it is just that in a private wiki no documents are accessible and thus also the sources aren't accessible. Otherwise, all sources are just stored in one document and this document should - under normal circumstances - not be restricted in any way. What I was more wondering is if implementing such a data source as document is our best practice or if, e.g., a REST API would better match our current best practices (but I really don't know). |
...amingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/javascript.vm
Outdated
Show resolved
Hide resolved
...orm-core/xwiki-platform-search/xwiki-platform-search-webjar/src/main/webjar/searchSuggest.js
Outdated
Show resolved
Hide resolved
* Fix removed escaping * Clean javascript.vm
Jira URL
https://jira.xwiki.org/browse/XWIKI-22155
Changes
Description
searchSuggest.js
by moving its Velocity code toXWiki.SearchSuggestCode
Clarifications
The Velocity code that returns the sources for search suggest can't work properly from a webjar because the context user is not propagated. The refactor fixes this issue.
Screenshots & Video
N/A
Executed Tests
The patch was applied manually to an instance with the main wiki private.
Expected merging strategy