It works if user 1 is commenting something on a file b.txt within A (A/b.txt)
@blizzz (as suggested by Joas)
GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/4246 (Shared folder to a group not shown in shared by me), https://github.com/nextcloud/server/issues/7125 (Plugins not working on Shared Folders), https://github.com/nextcloud/server/issues/5408 (Files: not all shares are shown if folder is marked as favorite), https://github.com/nextcloud/server/issues/10308 (Shared folder icons and text is showed inconsistently), and https://github.com/nextcloud/server/issues/1072 (Not possible to share current folder (need to display share icon in the breadcrumbs)).
The WebDAV property returns an unread count of 0. Debugging why tomorrow. So far I failed to see that DAV Comments plugins where pulled in at all (but the property is coming somehwere from).
I guess the crucial point is that the implementation of getNumberOfUnreadCommentsForFolder works against the filecache table and does not take mounts/shares into account. Thus, even if you get a number it is not necessarily precise.
@icewind1991 you've got an idea how to resolve this without losing too much of the performance benefits?
Fixed by #12897