Skip to content

Removing default name for new contact and leaving it blank - #488

Closed
rutujasurve94 wants to merge 7 commits into
nextcloud:masterfrom
rutujasurve94:feature/FN-field-empty-behaviour
Closed

rutujasurve94 wants to merge 7 commits into
nextcloud:masterfrom
rutujasurve94:feature/FN-field-empty-behaviour

Conversation

@rutujasurve94

Copy link
Copy Markdown

Removing the check that puts the default name 'New Contact' in case the contact field is new

@jancborchardt

Copy link
Copy Markdown
Member

@rutujasurve94 welcome to the Contacts app! 🎉 :)

@skjnldsv @Henni @juliushaertl this needs a Javascript review :)

@Henni

Henni commented Feb 26, 2018

Copy link
Copy Markdown
Member

I believe this leads to issues as the full name has to be defined. (Possibly fixed by #490)

@Henni

Henni commented Feb 26, 2018

Copy link
Copy Markdown
Member

Removing these lines is mostly fine, but we still have to catch imported contacts which do not have a FN field. So getting rid of the check for '' is fine, but we still have to check for undefined.

But to achieve the goal of this PR, the contact_model.js has to be modified as well.
@rutujasurve94 take a look at js/models/contact_model.js (line 439). This is where the fn property is initialized for new contacts. This should be replaced with an empty string, so that the property still exists, but the input field is blank.

@rutujasurve94

Copy link
Copy Markdown
Author

@Henni thanks a lot for the review, I'll modify the code soon and update it here

@codecov

codecov Bot commented Feb 27, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #488 into master will increase coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #488      +/-   ##
==========================================
+ Coverage    15.8%   15.88%   +0.07%     
==========================================
  Files          61       61              
  Lines        1379     1379              
==========================================
+ Hits          218      219       +1     
+ Misses       1161     1160       -1
Impacted Files Coverage Δ
js/models/contact_model.js 38.86% <ø> (+0.47%) ⬆️
js/services/contact_service.js 0.49% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 155e5f6...ac8f9e1. Read the comment docs.

@rutujasurve94

Copy link
Copy Markdown
Author

@Henni @jancborchardt I have modified the code in the file contact_model.js to substitute 'New Contact' with an empty string.

Henni
Henni previously requested changes Feb 27, 2018
Comment thread js/models/contact_model.js Outdated
angular.extend(this.props, {
version: [{value: '3.0'}],
fn: [{value: t('contacts', 'New contact')}]
fn: [{value: t('contacts', '')}]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The t() function translates a string to the local language. We don't need to translate ''. So just replace t('contacts', '') with ''.

newContact.uid(newUid);
newContact.setUrl(addressBook, newUid);
newContact.addressBookId = addressBook.displayName;
if (_.isUndefined(newContact.fullName()) || newContact.fullName() === '') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We still need to check if the fullName of newContact is undefined. So please add the first half of this check back in.

@rutujasurve94

Copy link
Copy Markdown
Author

@Henni @jancborchardt I have modified the code according to the review

@jancborchardt
jancborchardt requested a review from skjnldsv March 7, 2018 11:07
@jancborchardt

Copy link
Copy Markdown
Member

@nextcloud/contacts need further review here :)

@skjnldsv skjnldsv added enhancement New feature or request 3. to review Waiting for reviews design Related to the design papercut Annoying recurring issue with possibly simple fix. labels Mar 7, 2018

@skjnldsv skjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll still do't really like the idea of having empty contacts laying around.

  • The name field is still not docused on contact creation
  • Server still refusing the card
  • We need to make sure we don't have any issue when sorting the contact list if there are empty contacts in it

angular.extend(this.props, {
version: [{value: '3.0'}],
fn: [{value: t('contacts', 'New contact')}]
fn: [{value: ''}]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Server is still refusing the vcard

Validation error in vCard: The FN property must appear in the VCARD component exactly 1 time

I'll suggest using a space here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress design Related to the design enhancement New feature or request papercut Annoying recurring issue with possibly simple fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants