@@ -35,18 +35,17 @@ import { generateAvatarSvg } from '../utils/AccountIcon.ts'
3535import './sharingStatusAction.scss'
3636
3737const isExternal = ( node : Node ) => {
38- return node . attributes ?. [ 'is-federated' ] ?? false
38+ return node . attributes . remote_id !== undefined
3939}
4040
4141export const action = new FileAction ( {
4242 id : 'sharing-status' ,
4343 displayName ( nodes : Node [ ] ) {
4444 const node = nodes [ 0 ]
4545 const shareTypes = Object . values ( node ?. attributes ?. [ 'share-types' ] || { } ) . flat ( ) as number [ ]
46- const ownerId = node ?. attributes ?. [ 'owner-id' ]
4746
4847 if ( shareTypes . length > 0
49- || ( ownerId !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
48+ || ( node . owner !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
5049 return t ( 'files_sharing' , 'Shared' )
5150 }
5251
@@ -55,15 +54,14 @@ export const action = new FileAction({
5554
5655 title ( nodes : Node [ ] ) {
5756 const node = nodes [ 0 ]
58- const ownerId = node ?. attributes ?. [ 'owner-id' ]
59- const ownerDisplayName = node ?. attributes ?. [ 'owner-display-name' ]
6057
6158 // Mixed share types
6259 if ( Array . isArray ( node . attributes ?. [ 'share-types' ] ) && node . attributes ?. [ 'share-types' ] . length > 1 ) {
6360 return t ( 'files_sharing' , 'Shared multiple times with different people' )
6461 }
6562
66- if ( ownerId && ( ownerId !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
63+ if ( node . owner && ( node . owner !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
64+ const ownerDisplayName = node ?. attributes ?. [ 'owner-display-name' ]
6765 return t ( 'files_sharing' , 'Shared by {ownerDisplayName}' , { ownerDisplayName } )
6866 }
6967
@@ -96,10 +94,9 @@ export const action = new FileAction({
9694 return CircleSvg
9795 }
9896
99- const ownerId = node ?. attributes ?. [ 'owner-id' ]
100- if ( ownerId && ( ownerId !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
97+ if ( node . owner && ( node . owner !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
10198 const sanitizeId = ( id : string ) => id . replace ( / [ ^ a - z A - Z 0 - 9 . _ % + @ - ] + / g, '' ) . replace ( / \/ / g, '' )
102- return generateAvatarSvg ( sanitizeId ( ownerId ) , isExternal ( node ) )
99+ return generateAvatarSvg ( sanitizeId ( node . owner ) , isExternal ( node ) )
103100 }
104101
105102 return AccountPlusSvg
@@ -111,8 +108,8 @@ export const action = new FileAction({
111108 }
112109
113110 const node = nodes [ 0 ]
114- const ownerId = node ? .attributes ?. [ 'owner-id ' ]
115- const isMixed = Array . isArray ( node . attributes ?. [ 'share-types' ] )
111+ const shareTypes = node . attributes ?. [ 'share-types ' ]
112+ const isMixed = Array . isArray ( shareTypes ) && shareTypes . length > 0
116113
117114 // If the node is shared multiple times with
118115 // different share types to the current user
@@ -121,7 +118,7 @@ export const action = new FileAction({
121118 }
122119
123120 // If the node is shared by someone else
124- if ( ownerId && ( ownerId !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
121+ if ( node . owner && ( node . owner !== getCurrentUser ( ) ?. uid || isExternal ( node ) ) ) {
125122 return true
126123 }
127124
0 commit comments