Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function isEmpty(value) {
export const ContactKindProperties = ['KIND', 'X-ADDRESSBOOKSERVER-KIND']

export const MinimalContactProperties = [
'EMAIL', 'UID', 'TEL', 'CATEGORIES', 'FN', 'ORG', 'N', 'X-PHONETIC-FIRST-NAME', 'X-PHONETIC-LAST-NAME', 'X-MANAGERSNAME', 'TITLE', 'NOTE', 'RELATED',
'EMAIL', 'UID', 'TEL', 'CATEGORIES', 'FN', 'ORG', 'N', 'X-PHONETIC-FIRST-NAME', 'X-PHONETIC-LAST-NAME', 'X-MANAGERSNAME', 'TITLE', 'NOTE', 'RELATED', 'PRONOUNS',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should be dropped. we don't want to search on Pronoun

].concat(ContactKindProperties)

export function generateContactKey(uid, addressbookId) {
Expand Down
11 changes: 11 additions & 0 deletions src/models/rfcProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ const properties = {
],
primary: false,
},
pronouns: {
multiple: true,
readableName: t('contacts', 'Pronouns'),
icon: 'icon-gender',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This icon is already used for gender, @kra-mo , @nimishavijay (as vacation replacement) any recommendation on icon choice ?

force: 'text',
defaultValue: {
value: '',
},
primary: false,
},
tz: {
readableName: t('contacts', 'Time zone'),
force: 'select',
Expand Down Expand Up @@ -420,6 +430,7 @@ const fieldOrder = [
'x-phonetic-first-name',
'x-phonetic-last-name',
'gender',
'pronouns',
'cloud',
'impp',
'geo',
Expand Down
6 changes: 5 additions & 1 deletion tests/javascript/models/contact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Contact from '../../../src/models/contact'
import Contact, { MinimalContactProperties } from '../../../src/models/contact'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import Contact, { MinimalContactProperties } from '../../../src/models/contact'
import Contact from '../../../src/models/contact'


const getPropertyLines = (property, vcard) => {
return vcard.match(new RegExp(`^${property}[;:].*`, 'gmi'))
Expand Down Expand Up @@ -62,6 +62,10 @@ describe('Test stripping quotes from TYPE', () => {
expect(contactWithEmails.hasEmail('third@example.com')).toBe(false)
})

test('Test pronouns are included in the lightweight property list', () => {
expect(MinimalContactProperties).toContain('PRONOUNS')
})

Comment on lines +65 to +68

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test('Test pronouns are included in the lightweight property list', () => {
expect(MinimalContactProperties).toContain('PRONOUNS')
})

test('Test stripping quotes from MULTIPLE SPLIT TYPES and MULTIPLE PROPERTIES', () => {
const property2 = contact.vCard.addPropertyWithValue('TEl', '+99 876 543 210')
property.setParameter('type', ['WORK,VOICE'])
Expand Down
10 changes: 10 additions & 0 deletions tests/javascript/models/rfcProps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ describe('RFC props', () => {
expect(property.getParameter('type')).toEqual(defaultData.type)
expect(contact.vCard.toString()).toMatch(/^IMPP;TYPE=.+:$/m)
})

test('pronouns is a serializable RFC 9554 text property', () => {
const property = contact.vCard.addPropertyWithValue('pronouns', 'they/them')

expect(rfcProps.properties.pronouns.readableName).toBe(t('contacts', 'Pronouns'))
expect(rfcProps.properties.pronouns.multiple).toBe(true)
expect(rfcProps.fieldOrder.indexOf('pronouns')).toBeGreaterThan(rfcProps.fieldOrder.indexOf('gender'))
expect(rfcProps.properties.pronouns.force).toBe('text')
expect(contact.vCard.toString()).toMatch(/^PRONOUNS:they\/them$/m)
})
})
Loading