Compare commits

...

2 Commits

Author SHA1 Message Date
Christoph Wurst afa3de9885
Merge pull request #5904 from nextcloud/enh/show-email-in-sharing
Add email information when sharing
2024-04-26 11:34:39 +02:00
Grigory Vodyanov 4837945888 Add email to sharing dialogs
Signed-off-by: Grigory Vodyanov <scratchx@gmx.com>
2024-04-25 18:06:16 +02:00
2 changed files with 78 additions and 4 deletions

View File

@ -27,9 +27,12 @@
<AccountGroupIcon v-else-if="sharee.isCircle" :size="20" class="share-item__team-icon" /> <AccountGroupIcon v-else-if="sharee.isCircle" :size="20" class="share-item__team-icon" />
<NcAvatar v-else :user="sharee.userId" :display-name="sharee.displayName" /> <NcAvatar v-else :user="sharee.userId" :display-name="sharee.displayName" />
<p class="share-item__label"> <div class="share-item__label">
{{ displayName }} {{ sharee.displayName }}
</p> <p>
{{ shareeEmail }}
</p>
</div>
<input :id="`${id}-can-edit`" <input :id="`${id}-can-edit`"
:disabled="updatingSharee" :disabled="updatingSharee"
@ -85,6 +88,7 @@ export default {
return { return {
id: randomId(), id: randomId(),
updatingSharee: false, updatingSharee: false,
shareeEmail: '',
} }
}, },
computed: { computed: {
@ -104,6 +108,9 @@ export default {
return this.sharee.displayName return this.sharee.displayName
} }
}, },
mounted() {
this.updateShareeEmail()
},
methods: { methods: {
/** /**
* Unshares the calendar from the given sharee * Unshares the calendar from the given sharee
@ -145,6 +152,20 @@ export default {
this.updatingSharee = false this.updatingSharee = false
} }
}, },
async updateShareeEmail() {
if (this.sharee.isGroup || this.sharee.isCircle) {
return
}
const shareeUrl = this.sharee.uri.replace('principal:', '/remote.php/dav/') + '/'
await this.$store.dispatch('fetchPrincipalByUrl', { url: shareeUrl })
const principal = this.$store.getters.getPrincipalByUrl(shareeUrl)
this.shareeEmail = principal.emailAddress
},
}, },
} }
</script> </script>
@ -173,6 +194,12 @@ export default {
&__label { &__label {
flex: 1 auto; flex: 1 auto;
flex-direction: column;
p {
color: var(--color-text-lighter);
line-height: 1;
}
} }
} }
</style> </style>

View File

@ -43,21 +43,40 @@
<template #no-options> <template #no-options>
<span>{{ $t('calendar', 'No users or groups') }}</span> <span>{{ $t('calendar', 'No users or groups') }}</span>
</template> </template>
<template #option="sharee">
<div class="share-item">
<AccountMultiple v-if="sharee.isGroup" :size="20" class="share-item__group-icon" />
<AccountGroupIcon v-else-if="sharee.isCircle" :size="20" class="share-item__team-icon" />
<NcAvatar v-else :user="sharee.userId" :display-name="sharee.displayName" />
<div class="share-item__label">
{{ sharee.displayName }}
<p>
{{ sharee.email }}
</p>
</div>
</div>
</template>
</NcSelect> </NcSelect>
</div> </div>
</template> </template>
<script> <script>
import { NcSelect } from '@nextcloud/vue' import { NcAvatar, NcSelect } from '@nextcloud/vue'
import { principalPropertySearchByDisplaynameOrEmail } from '../../../services/caldavService.js' import { principalPropertySearchByDisplaynameOrEmail } from '../../../services/caldavService.js'
import HttpClient from '@nextcloud/axios' import HttpClient from '@nextcloud/axios'
import debounce from 'debounce' import debounce from 'debounce'
import { generateOcsUrl } from '@nextcloud/router' import { generateOcsUrl } from '@nextcloud/router'
import { urldecode } from '../../../utils/url.js' import { urldecode } from '../../../utils/url.js'
import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue'
import AccountGroupIcon from 'vue-material-design-icons/AccountGroup.vue'
export default { export default {
name: 'SharingSearch', name: 'SharingSearch',
components: { components: {
NcAvatar,
AccountGroupIcon,
AccountMultiple,
NcSelect, NcSelect,
}, },
props: { props: {
@ -141,6 +160,7 @@ export default {
this.inputGiven = false this.inputGiven = false
this.isLoading = false this.isLoading = false
} }
}, 500), }, 500),
/** /**
* *
@ -188,6 +208,7 @@ export default {
isCircle: false, isCircle: false,
isNoUser: isGroup, isNoUser: isGroup,
search: query, search: query,
email: result.email,
}) })
return list return list
}, []) }, [])
@ -255,4 +276,30 @@ export default {
flex: 1 auto; flex: 1 auto;
} }
} }
.share-item {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
&__group-icon,
&__team-icon {
width: 32px;
height: 32px;
border-radius: 16px;
color: white;
background-color: var(--color-text-maxcontrast);
}
&__label {
flex: 1 auto;
flex-direction: column;
p {
color: var(--color-text-lighter);
line-height: 1;
}
}
}
</style> </style>