2323 inline />
2424 {{ size }}
2525 <NcDateTime :timestamp =" fileInfo.mtime" />
26+ <NcUserBubble
27+ :user =" ownerId"
28+ :display-name =" nodeOwnerLabel" />
2629 </template >
27-
2830 <!-- TODO: create a standard to allow multiple elements here? -->
2931 <template v-if =" fileInfo " #description >
3032 <div class =" sidebar__description" >
@@ -95,6 +97,7 @@ import { encodePath } from '@nextcloud/paths'
9597import { generateRemoteUrl , generateUrl } from ' @nextcloud/router'
9698import { ShareType } from ' @nextcloud/sharing'
9799import { mdiStar , mdiStarOutline } from ' @mdi/js'
100+ import { fetchNode } from ' ../services/WebdavClient.ts'
98101import axios from ' @nextcloud/axios'
99102import $ from ' jquery'
100103
@@ -103,6 +106,7 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
103106import NcDateTime from ' @nextcloud/vue/dist/Components/NcDateTime.js'
104107import NcEmptyContent from ' @nextcloud/vue/dist/Components/NcEmptyContent.js'
105108import NcIconSvgWrapper from ' @nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
109+ import NcUserBubble from ' @nextcloud/vue/dist/Components/NcUserBubble.js'
106110
107111import FileInfo from ' ../services/FileInfo.js'
108112import LegacyView from ' ../components/LegacyView.vue'
@@ -122,6 +126,7 @@ export default {
122126 NcIconSvgWrapper,
123127 SidebarTab,
124128 SystemTags,
129+ NcUserBubble,
125130 },
126131
127132 setup () {
@@ -145,6 +150,7 @@ export default {
145150 error: null ,
146151 loading: true ,
147152 fileInfo: null ,
153+ node: null ,
148154 isFullScreen: false ,
149155 hasLowHeight: false ,
150156 }
@@ -287,6 +293,25 @@ export default {
287293 isSystemTagsEnabled () {
288294 return getCapabilities ()? .systemtags ? .enabled === true
289295 },
296+ ownerId () {
297+ return this .node ? .attributes ? .[' owner-id' ]
298+ },
299+ currentUserIsOwner () {
300+ return this .ownerId && this .ownerId === this .currentUser
301+ },
302+ nodeOwnerLabel () {
303+ if (this .currentUserIsOwner ) {
304+ return t (' files' , ' Owned by you' )
305+ }
306+ const ownerDisplayName = this .node ? .attributes ? .[' owner-display-name' ]
307+ return t (' files' , ' Owned by {ownerDisplayName}' , { ownerDisplayName })
308+ },
309+ sharedMultipleTimes () {
310+ if (Array .isArray (node .attributes ? .[' share-types' ]) && node .attributes ? .[' share-types' ].length > 1 ) {
311+ return t (' files' , ' Shared multiple times with different people' )
312+ }
313+ return null
314+ },
290315 },
291316 created () {
292317 subscribe (' files:node:deleted' , this .onNodeDeleted )
@@ -298,7 +323,6 @@ export default {
298323 unsubscribe (' file:node:deleted' , this .onNodeDeleted )
299324 window .removeEventListener (' resize' , this .handleWindowResize )
300325 },
301-
302326 methods: {
303327 /**
304328 * Can this tab be displayed ?
@@ -460,6 +484,7 @@ export default {
460484 this .fileInfo = await FileInfo (this .davPath )
461485 // adding this as fallback because other apps expect it
462486 this .fileInfo .dir = this .file .split (' /' ).slice (0 , - 1 ).join (' /' )
487+ this .node = await fetchNode ({ path: (this .fileInfo .path + ' /' + this .fileInfo .name ).replace (' //' , ' /' ) })
463488
464489 // DEPRECATED legacy views
465490 // TODO: remove
@@ -549,6 +574,12 @@ export default {
549574 handleWindowResize () {
550575 this .hasLowHeight = document .documentElement .clientHeight < 1024
551576 },
577+ sharedMultipleTimes () {
578+ // Mixed share types
579+ if (Array .isArray (this .node .attributes ? .[' share-types' ]) && this .node .attributes ? .[' share-types' ].length > 1 ) {
580+ return t (' files' , ' Shared multiple times with different people' )
581+ }
582+ },
552583 },
553584}
554585< / script>
0 commit comments