@@ -27,6 +27,7 @@ import {
2727 toggleCreateFolderModal ,
2828 getSharingContainers ,
2929 getSharedContainers ,
30+ getAccessDetails ,
3031 toggleCopyFolderModal ,
3132} from " @/common/globalFunctions" ;
3233import {swiftDeleteContainer } from " @/common/api" ;
@@ -139,7 +140,18 @@ export default {
139140 return " " ;
140141 };
141142
142- this .containers = this .conts .slice (offset, offset + limit).reduce ((
143+ // Map the 'accessRights' to the container if it's a shared container
144+ const mappedContainers = await Promise .all (this .conts .map (async (cont) => {
145+ const sharedDetails = cont .owner ? await getAccessDetails (
146+ this .$route .params .project ,
147+ cont .container ,
148+ cont .owner ) : null ;
149+ const accessRights = sharedDetails ? sharedDetails .access : null ;
150+ return sharedDetails && accessRights ?
151+ {... cont, accessRights} : {... cont};
152+ }));
153+
154+ this .containers = mappedContainers .slice (offset, offset + limit).reduce ((
143155 items,
144156 item,
145157 ) => {
@@ -230,35 +242,24 @@ export default {
230242 },
231243 },
232244 // Share button is disabled for Shared (with you) Folders
233- item .owner ?
234- {
235- value: null ,
236- component: {
237- tag: " c-button" ,
238- params: {
239- text: true ,
240- size: " small" ,
241- disabled: true ,
242- },
243- },
244- } :
245- {
246- value: this .$t (" message.share.share" ),
247- component: {
248- tag: " c-button" ,
249- params: {
250- text: true ,
251- size: " small" ,
252- title: this .$t (" message.share.share" ),
253- path: mdiShareVariantOutline,
254- onClick : (item ) => {
255- this .$store .commit (" toggleShareModal" , true );
256- this .$store .commit (
257- " setFolderName" , item .data .name .value );
258- },
245+ {
246+ value: this .$t (" message.share.share" ),
247+ component: {
248+ tag: " c-button" ,
249+ params: {
250+ text: true ,
251+ size: " small" ,
252+ title: this .$t (" message.share.share" ),
253+ path: mdiShareVariantOutline,
254+ onClick : (item ) => {
255+ this .$store .commit (" toggleShareModal" , true );
256+ this .$store .commit (
257+ " setFolderName" , item .data .name .value );
259258 },
259+ disabled: item .owner ,
260260 },
261261 },
262+ },
262263 {
263264 value: null ,
264265 component: {
@@ -267,7 +268,7 @@ export default {
267268 items: [
268269 {
269270 name: this .$t (" message.copy" ),
270- action: item .owner
271+ action: item .owner
271272 ? () => toggleCopyFolderModal (item .name , item .owner )
272273 : () => toggleCopyFolderModal (item .name ),
273274 disabled: ! item .bytes ? true : false ,
@@ -281,22 +282,24 @@ export default {
281282 action : () => this .confirmDelete (
282283 item .name , item .count ,
283284 ),
285+ disabled: item .owner && item .accessRights .length > 1 ,
284286 },
285287 ],
286288 customTrigger: {
287289 value: this .$t (" message.options" ),
290+ disabled: true ,
288291 component: {
289292 tag: " c-button" ,
290293 params: {
291294 text: true ,
292295 path: mdiDotsHorizontal,
293296 title: " Menu with custom trigger" ,
294297 size: " small" ,
298+ disabled: item .owner
299+ && item .accessRights .length === 1 ,
295300 },
296301 },
297302 },
298- path: mdiDotsHorizontal,
299-
300303 },
301304 },
302305 },
0 commit comments