Skip to content

Commit e2f73ee

Browse files
Merge pull request #63713 from nextcloud/backport/63689/stable35
[stable35] fix(contactsmenu): restore avatars for non-user contacts
2 parents f6125d9 + be0b1f2 commit e2f73ee

4 files changed

Lines changed: 47 additions & 4 deletions

File tree

core/src/components/ContactsMenu/ContactMenuEntry.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
:user="contact.isUser ? contact.uid : undefined"
1111
:is-no-user="!contact.isUser"
1212
:disable-menu="true"
13-
:display-name="contact.avatarLabel"
13+
:display-name="contact.fullName"
14+
:url="contact.isUser ? undefined : contact.avatar"
1415
:preloaded-user-status="preloadedUserStatus" />
1516
<a
1617
class="contact__body"

core/src/tests/components/ContactsMenu/ContactMenuEntry.spec.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,51 @@
55

66
import { shallowMount } from '@vue/test-utils'
77
import { describe, expect, it } from 'vitest'
8+
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
89
import ContactMenuEntry from '../../../components/ContactsMenu/ContactMenuEntry.vue'
910

1011
describe('Contact', function() {
12+
it('passes the avatar url to non-user contacts', () => {
13+
const view = shallowMount(ContactMenuEntry, {
14+
propsData: {
15+
contact: {
16+
id: '11111111-2222-3333-4444-555555555555',
17+
uid: '11111111-2222-3333-4444-555555555555',
18+
fullName: 'Jane Doe',
19+
avatar: 'https://localhost/remote.php/dav/addressbooks/users/admin/contacts/jane.vcf?photo',
20+
isUser: false,
21+
emailAddresses: [],
22+
actions: [],
23+
},
24+
},
25+
})
26+
27+
const avatar = view.findComponent(NcAvatar)
28+
expect(avatar.props('user')).toBeUndefined()
29+
expect(avatar.props('url')).toBe('https://localhost/remote.php/dav/addressbooks/users/admin/contacts/jane.vcf?photo')
30+
expect(avatar.props('displayName')).toBe('Jane Doe')
31+
})
32+
33+
it('lets user contacts resolve the avatar via their user id', () => {
34+
const view = shallowMount(ContactMenuEntry, {
35+
propsData: {
36+
contact: {
37+
id: 'jane',
38+
uid: 'jane',
39+
fullName: 'Jane Doe',
40+
avatar: 'https://localhost/remote.php/dav/addressbooks/system/system/system/jane.vcf?photo',
41+
isUser: true,
42+
emailAddresses: [],
43+
actions: [],
44+
},
45+
},
46+
})
47+
48+
const avatar = view.findComponent(NcAvatar)
49+
expect(avatar.props('user')).toBe('jane')
50+
expect(avatar.props('url')).toBeUndefined()
51+
})
52+
1153
it('links to the top action', () => {
1254
const view = shallowMount(ContactMenuEntry, {
1355
propsData: {

dist/core-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)