nextcloud / nextcloud/contacts

How do I add system-generated contacts to a contact group

Open
#3,596 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement
Dominant language
JavaScript
Stars
642
Forks
220
Avg merge
14h 39m
Merged PRs (30d)
51

Description

Is your feature request related to a problem? Please describe.

contacts doesn't support adding system-generated contacts, and I tried to add system-generated contacts to a contact group by modifying the code, but that didn't work.

addContactsToGroup(group) {
			console.debug('Contacts picker opened for group', group)

			// Get the full group if we provided the group name only
			if (typeof group === 'string') {
				group = this.groups.find(a => a.name === group)
				if (!group) {
					console.error('Cannot add contact to an undefined group', group)
					return
				}
			}

			// Init data set
			this.pickerData = this.sortedContacts
				.map(({ key }) => {
					const contact = this.contacts[key]
					return {
						id: contact.key,
						label: contact.displayName,
						type: 'contact',
						readOnly: contact.addressbook.readOnly,
						groups: contact.groups,
					}
				})
				// No read only contacts
				// .filter(contact => !contact.readOnly)  comment this!
				// No contacts already present in group
				.filter(contact => contact.groups.indexOf(group.name) === -1)

			this.showPicker = true
			this.pickerforGroup = group
		},
Describe the solution you'd like

I want contact groups to support the addition of system-generated contacts.

Describe alternatives you've considered

I don't know exactly how to implement it at the moment, and if anyone can give me some advice, I would be very grateful.

Additional context

image
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the addContactsToGroup(group) entry point shown in the issue and trace how pickerData and group membership are handled for system-generated contacts. Compare the current readOnly filtering and group assignment flow with the contact data shown by the picker. Done means system-generated contacts can be added to a contact group without breaking existing read-only behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.