Skip to content
Snippets Groups Projects
Commit 1ccbc2e7 authored by Eduard Moraru's avatar Eduard Moraru
Browse files

XWIKI-12490: Watchlist does not notify about events in Nested Spaces of a watched space

parent d558a085
No related branches found
No related tags found
No related merge requests found
...@@ -183,7 +183,22 @@ public boolean isWatched(String element, String user, WatchedElementType type) t ...@@ -183,7 +183,22 @@ public boolean isWatched(String element, String user, WatchedElementType type) t
// TODO: Can this be optimized by a direct "exists" query on the list item? Would it e better than what we // TODO: Can this be optimized by a direct "exists" query on the list item? Would it e better than what we
// currently have with the document cache? If we try a query, it would also need to be performed on the user's // currently have with the document cache? If we try a query, it would also need to be performed on the user's
// wiki/database, not the current one. // wiki/database, not the current one.
return getWatchedElements(user, type).contains(element); Collection<String> watchedElements = getWatchedElements(user, type);
if (WatchedElementType.SPACE.equals(type)) {
// Special handling for Nested Spaces
for (String watchedSpace : watchedElements) {
// Check if there is an exact match on the watched space or if the current space is nested inside a
// watched space.
String watchedSpacePrefix = String.format("%s.", watchedSpace);
if (element.equals(watchedSpace) || element.startsWith(watchedSpacePrefix)) {
return true;
}
}
return false;
} else {
return watchedElements.contains(element);
}
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment