File tree Expand file tree Collapse file tree 2 files changed +9
-27
lines changed
apps/systemtags/lib/Activity Expand file tree Collapse file tree 2 files changed +9
-27
lines changed Original file line number Diff line number Diff line change 2929use OCP \App \IAppManager ;
3030use OCP \Files \Config \IMountProviderCollection ;
3131use OCP \Files \IRootFolder ;
32- use OCP \Files \Node ;
3332use OCP \IConfig ;
3433use OCP \IGroup ;
3534use OCP \IGroupManager ;
@@ -171,22 +170,16 @@ public function mapperEvent(MapperEvent $event) {
171170
172171 // Get all mount point owners
173172 $ cache = $ this ->mountCollection ->getMountCache ();
174- $ mounts = $ cache ->getMountsForFileId ($ event ->getObjectId ());
175- if (empty ($ mounts )) {
176- return ;
177- }
178173
179174 $ users = [];
180- foreach ($ mounts as $ mount ) {
181- $ owner = $ mount ->getUser ()->getUID ();
182- $ ownerFolder = $ this ->rootFolder ->getUserFolder ($ owner );
183- $ nodes = $ ownerFolder ->getById ($ event ->getObjectId ());
184- if (!empty ($ nodes )) {
185- /** @var Node $node */
186- $ node = array_shift ($ nodes );
187- $ al = $ this ->shareHelper ->getPathsForAccessList ($ node );
188- $ users += $ al ['users ' ];
189- }
175+ $ filesPerUser = $ cache ->getFilesByUserId ((int )$ event ->getComment ()->getObjectId ());
176+ if (empty ($ filesPerUser )) {
177+ return ;
178+ }
179+ foreach ($ filesPerUser as $ user => $ files ) {
180+ /* Remove /user/files prefix */
181+ $ sections = explode ('/ ' , reset ($ files )?->getPath() ?? '' , 4 );
182+ $ users [$ user ] = '/ ' .($ sections [3 ] ?? '' );
190183 }
191184
192185 $ actor = $ this ->session ->getUser ();
Original file line number Diff line number Diff line change @@ -72,18 +72,7 @@ public function getFilesByUser(FileInfo $file): array {
7272 return [];
7373 }
7474
75- $ mounts = $ this ->userMountCache ->getMountsForFileId ($ id );
76- $ result = [];
77- foreach ($ mounts as $ mount ) {
78- if (isset ($ result [$ mount ->getUser ()->getUID ()])) {
79- continue ;
80- }
81-
82- $ userFolder = $ this ->rootFolder ->getUserFolder ($ mount ->getUser ()->getUID ());
83- $ result [$ mount ->getUser ()->getUID ()] = $ userFolder ->getById ($ id );
84- }
85-
86- return $ result ;
75+ return $ this ->userMountCache ->getNodesByUserForFileId ($ id );
8776 }
8877
8978 /**
You can’t perform that action at this time.
0 commit comments