Compare commits

...

5 Commits

Author SHA1 Message Date
Javier E. Fajardo baa3c4bb50
Merge 8cbb9e2274 into afa3de9885 2024-04-26 07:03:05 -07:00
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
Javier E. Fajardo 8cbb9e2274 Fix lint issues and the eventSourceFunction tests
Signed-off-by: Javier E. Fajardo <javier@fajardo.io>
2021-04-23 18:07:40 -07:00
Javier E. Fajardo 9caf74965b Set task start if available to allow visualization
Signed-off-by: Javier E. Fajardo <javier@fajardo.io>
2021-04-20 00:42:31 -07:00
4 changed files with 104 additions and 28 deletions

View File

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

View File

@ -43,21 +43,40 @@
<template #no-options>
<span>{{ $t('calendar', 'No users or groups') }}</span>
</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>
</div>
</template>
<script>
import { NcSelect } from '@nextcloud/vue'
import { NcAvatar, NcSelect } from '@nextcloud/vue'
import { principalPropertySearchByDisplaynameOrEmail } from '../../../services/caldavService.js'
import HttpClient from '@nextcloud/axios'
import debounce from 'debounce'
import { generateOcsUrl } from '@nextcloud/router'
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 {
name: 'SharingSearch',
components: {
NcAvatar,
AccountGroupIcon,
AccountMultiple,
NcSelect,
},
props: {
@ -141,6 +160,7 @@ export default {
this.inputGiven = false
this.isLoading = false
}
}, 500),
/**
*
@ -188,6 +208,7 @@ export default {
isCircle: false,
isNoUser: isGroup,
search: query,
email: result.email,
})
return list
}, [])
@ -255,4 +276,30 @@ export default {
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>

View File

@ -73,10 +73,12 @@ export function eventSourceFunction(calendarObjects, calendar, start, end, timez
jsStart = object.startDate.getInTimezone(timezone).jsDate
jsEnd = object.endDate.getInTimezone(timezone).jsDate
} else if (object.name === 'VTODO') {
// For tasks, we only want to display when it is due,
// not for how long it has been in progress already
jsStart = object.endDate.getInTimezone(timezone).jsDate
jsEnd = object.endDate.getInTimezone(timezone).jsDate
jsStart = jsEnd = object.endDate.getInTimezone(timezone).jsDate
// If available, set task start to allow visualization
if (object.startDate) {
jsStart = object.startDate.getInTimezone(timezone).jsDate
}
} else {
// We do not want to display anything that's neither
// an event nor a task

View File

@ -592,7 +592,7 @@ describe('fullcalendar/freeBusyResourceEventSourceFunction test suite', () => {
recurrenceId: 123,
},
id: '1###1',
start: event1End,
start: event1Start,
title: 'Untitled task',
}, {
allDay: false,
@ -613,7 +613,7 @@ describe('fullcalendar/freeBusyResourceEventSourceFunction test suite', () => {
recurrenceId: 123,
},
id: '1###2',
start: event2End,
start: event2Start,
title: 'Untitled task',
}, {
allDay: false,
@ -634,7 +634,7 @@ describe('fullcalendar/freeBusyResourceEventSourceFunction test suite', () => {
recurrenceId: 123,
},
id: '1###3',
start: event3End,
start: event3Start,
title: 'Untitled task (99%)',
}, {
allDay: false,
@ -655,7 +655,7 @@ describe('fullcalendar/freeBusyResourceEventSourceFunction test suite', () => {
recurrenceId: 123,
},
id: '1###4',
start: event4End,
start: event4Start,
title: 'This task has a title',
}, {
allDay: false,
@ -676,30 +676,30 @@ describe('fullcalendar/freeBusyResourceEventSourceFunction test suite', () => {
recurrenceId: 123,
},
id: '1###5',
start: event5End,
start: event5Start,
title: 'This task has a title and percent (99%)',
}])
expect(eventComponentSet[0].startDate.getInTimezone).toHaveBeenCalledTimes(0)
expect(eventComponentSet[0].endDate.getInTimezone).toHaveBeenCalledTimes(2)
expect(eventComponentSet[0].startDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[0].startDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[0].endDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[0].endDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[0].endDate.getInTimezone).toHaveBeenNthCalledWith(2, timezone)
expect(eventComponentSet[1].startDate.getInTimezone).toHaveBeenCalledTimes(0)
expect(eventComponentSet[1].endDate.getInTimezone).toHaveBeenCalledTimes(2)
expect(eventComponentSet[1].startDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[1].startDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[1].endDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[1].endDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[1].endDate.getInTimezone).toHaveBeenNthCalledWith(2, timezone)
expect(eventComponentSet[2].startDate.getInTimezone).toHaveBeenCalledTimes(0)
expect(eventComponentSet[2].endDate.getInTimezone).toHaveBeenCalledTimes(2)
expect(eventComponentSet[2].startDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[2].startDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[2].endDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[2].endDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[2].endDate.getInTimezone).toHaveBeenNthCalledWith(2, timezone)
expect(eventComponentSet[3].startDate.getInTimezone).toHaveBeenCalledTimes(0)
expect(eventComponentSet[3].endDate.getInTimezone).toHaveBeenCalledTimes(2)
expect(eventComponentSet[3].startDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[3].startDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[3].endDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[3].endDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[3].endDate.getInTimezone).toHaveBeenNthCalledWith(2, timezone)
expect(eventComponentSet[4].startDate.getInTimezone).toHaveBeenCalledTimes(0)
expect(eventComponentSet[4].endDate.getInTimezone).toHaveBeenCalledTimes(2)
expect(eventComponentSet[4].startDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[4].startDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[4].endDate.getInTimezone).toHaveBeenCalledTimes(1)
expect(eventComponentSet[4].endDate.getInTimezone).toHaveBeenNthCalledWith(1, timezone)
expect(eventComponentSet[4].endDate.getInTimezone).toHaveBeenNthCalledWith(2, timezone)
expect(translate).toHaveBeenCalledTimes(3)
expect(translate).toHaveBeenNthCalledWith(1, 'calendar', 'Untitled task')