2222
2323<template >
2424 <li class =" sharing-entry" >
25- <Avatar class="sharing-entry__avatar" />
26- <div class =" sharing-entry__desc" v-tooltip =" tooltip" >
25+ <Avatar class="sharing-entry__avatar" :user =" share .shareWith "
26+ :display-name =" share .shareWithDisplayName " />
27+ <div class =" sharing-entry__desc" v-tooltip.auto =" tooltip" >
2728 <h4 >{{ title }}</h4 >
28- <p v-if =" subtitle" >{{ subtitle }}</p >
2929 </div >
3030 <Actions menu-align="right" class="sharing-entry__actions">
3131 <slot />
@@ -40,6 +40,18 @@ import Tooltip from 'nextcloud-vue/dist/Directives/Tooltip'
4040
4141import Share from ' ../models/Share'
4242
43+ const SHARE_TYPES = {
44+ SHARE_TYPE_USER : OC .Share .SHARE_TYPE_USER ,
45+ SHARE_TYPE_GROUP : OC .Share .SHARE_TYPE_GROUP ,
46+ SHARE_TYPE_LINK : OC .Share .SHARE_TYPE_LINK ,
47+ SHARE_TYPE_EMAIL : OC .Share .SHARE_TYPE_EMAIL ,
48+ SHARE_TYPE_REMOTE : OC .Share .SHARE_TYPE_REMOTE ,
49+ SHARE_TYPE_CIRCLE : OC .Share .SHARE_TYPE_CIRCLE ,
50+ SHARE_TYPE_GUEST : OC .Share .SHARE_TYPE_GUEST ,
51+ SHARE_TYPE_REMOTE_GROUP : OC .Share .SHARE_TYPE_REMOTE_GROUP ,
52+ SHARE_TYPE_ROOM : OC .Share .SHARE_TYPE_ROOM
53+ }
54+
4355export default {
4456 name: ' SharingEntry' ,
4557
@@ -72,35 +84,33 @@ export default {
7284 },
7385
7486 computed: {
75- // title() {
76- // if (share.type === SHARE_TYPES.SHARE_TYPE_GROUP) {
77- // // adding group info
78- // return `${share.shareWithDisplayName} (group)`
79- // } else if (share.type === SHARE_TYPES.SHARE_TYPE_GROUP)
80- // }
81- // // GROUP AND USER
82- // if (share.type === SHARE_TYPES.SHARE_TYPE_USER
83- // || share.type === SHARE_TYPES.SHARE_TYPE_GROUP) {
84- // result.user = share.shareWith
85- // result.displayName = share.shareWithDisplayName
86- // result.title = share.shareWithDisplayName
87-
88- // // If the file owner is not the share owner,
89- // // we show who created the share
90- // if (share.owner !== share.fileOwner) {
91- // result.tooltip = t('files_sharing', 'Shared with {user} by {owner}', { user: share.shareWithDisplayName, owner: share.owner })
92- // }
93- // }
94-
95- // // GROUP
96- // if (share.type === SHARE_TYPES.SHARE_TYPE_GROUP) {
97- // // adding group info
98- // result.title += ' (group)'
99- // }
87+ title () {
88+ let title = this .share .shareWithDisplayName
89+ if (this .share .type === SHARE_TYPES .SHARE_TYPE_GROUP ) {
90+ title += ` (${ t (' files_sharing' , ' group' ) } )`
91+ } else if (this .share .type === SHARE_TYPES .SHARE_TYPE_ROOM ) {
92+ title += ` (${ t (' files_sharing' , ' conversation' ) } )`
93+ }
94+ return title
95+ },
96+ tooltip () {
97+ if (this .share .owner !== this .share .uidFileOwner ) {
98+ const data = {
99+ // todo: strong or italic?
100+ // but the t function escape any html from the data :/
101+ user: this .share .shareWithDisplayName ,
102+ owner: this .share .owner
103+ }
104+
105+ if (this .share .type === SHARE_TYPES .SHARE_TYPE_GROUP ) {
106+ return t (' files_sharing' , ' Shared with the group {user} by {owner}' , data)
107+ } else if (this .share .type === SHARE_TYPES .SHARE_TYPE_ROOM ) {
108+ return t (' files_sharing' , ' Shared with the conversation {user} by {owner}' , data)
109+ }
100110
101- // // always forward the id
102- // result.id = share.id
103- // return result
111+ return t ( ' files_sharing ' , ' Shared with {user} by {owner} ' , data)
112+ }
113+ }
104114 },
105115
106116 methods: {
0 commit comments