Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show fields for phone, email, address and groups by default for new contact #253

Closed
jancborchardt opened this issue Jul 4, 2017 · 26 comments

Comments

Projects
8 participants
@jancborchardt
Copy link
Member

commented Jul 4, 2017

When pressing the »New contact« button, you are faced with only the header for picture and name, as wel as the groups dropdown.

Phone, email and address should be displayed for any new contact. It was like that before too.

@jancborchardt jancborchardt added this to Possible issues in RailsGirls Summer of Code Jul 5, 2017

@xh3n1 xh3n1 moved this from 💡 Possible issues to 👩‍💻 In progress in RailsGirls Summer of Code Jul 6, 2017

@xh3n1

This comment has been minimized.

Copy link
Member

commented Jul 17, 2017

The problem with adding the 3 props tel email and adr to the template is that after they are created in the controller they do not have a $$hashKey. I tried multiple things, such as adding track by value option to the foreach loop but no good because it said it contained dupes. Therefore, I'm stuck atm and don't know how to proceed. Any advice would be appreciated.

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Jul 18, 2017

The problem with adding the 3 props tel email and adr to the template is that after they are created in the controller they do not have a $$hashKey. I tried multiple things, such as adding track by value option to the foreach loop but no good because it said it contained dupes. Therefore, I'm stuck atm and don't know how to proceed. Any advice would be appreciated.

@xh3n1 Do you have the code change available somewhere? Then I can have a look. Angular is sometimes a bit tricky to tame 😉

cc @georgehrke

@xh3n1

This comment has been minimized.

Copy link
Member

commented Jul 18, 2017

@MorrisJobke There is no code change. The issue is that when the 3 properties are added on line 11 in newContactButton_controller.js file, the created objects do not have a hashkey and therefore the template is not updated. What do you suggest?

@xh3n1

This comment has been minimized.

Copy link
Member

commented Jul 18, 2017

hey @MorrisJobke, I just did a little test by adding $$hashKey property to the created tel object/prop and to the value level. It was still unresponsive, meaning it did not update the template accordingly. What I also suspect now is that the contact object on line 11 mentioned above is not the same with contact object being displayed in the template. Could you look into my assumptions? cc @nickvergessen Thank you!

@xh3n1

This comment has been minimized.

Copy link
Member

commented Jul 19, 2017

@georgehrke

This comment has been minimized.

Copy link
Member

commented Jul 20, 2017

This is no angular issue, but simply a bug introduced by 028df62

The contact object is created in this function, created on the server and stored in the cache:

this.create = function(newContact, addressBook, uid) {

Let's call it contact1.

The four properties are added here, but the contact is not being updated on the server.

ContactService.create().then(function(contact) {

Let's call it contact2.

contact1 === contact2

The detail view is loaded here:

ctrl.changeContact = function(uid) {

It catches the contact from the Contactservice here:

this.getById = function(addressBooks, uid) {

As a first step, it catches the contact object from the cache. let's call that contact3.
contact1 === contact2 === contact3

but then it queries the server for the latest contact:
https://github.com/nextcloud/contacts/blob/c506cd69e25325cc11d77b2da163e8a655af9734/js/services/contact_service.js#L146L158

A new contact object (contact4) is created here based on the latest server data:

function (vcards) { return new Contact(addressBook, vcards[0]); }

We didn't update the contact on the server when we added the four properties, hence these changes are lost now.

Now we have contact1 === contact2 === contact3 !== contact4

@jonatoni jonatoni moved this from 👩‍💻 In progress to 🙋 Pull request to review in RailsGirls Summer of Code Jul 20, 2017

@jonatoni jonatoni moved this from 🙋 Pull request to review to 👩‍💻 In progress in RailsGirls Summer of Code Jul 20, 2017

@skjnldsv

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

Manually trigger a server update after adding the properties might help indeed.
But since we're creating a new card, the proper way should be NOT to query the server and keep the freshly created contact in the browser cache until the user edit the card.

@jancborchardt jancborchardt moved this from 👩‍💻 In progress to 🙋 Pull request to review in RailsGirls Summer of Code Aug 9, 2017

@skjnldsv skjnldsv moved this from 🙋 Pull request to review to 👩‍💻 In progress in RailsGirls Summer of Code Aug 9, 2017

@rutujasurve94

This comment has been minimized.

Copy link

commented Feb 19, 2018

I would like to take this bug up as a part of beginner level bug for Rails Girls Summer of Code 2018

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Feb 19, 2018

@rutujasurve94 Nice :) Could we somehow help you? I'm not 100% familiar with contacts but maybe @skjnldsv @xh3n1 or @jonatoni could help out? Or @Henni / @irgendwie

@rutujasurve94

This comment has been minimized.

Copy link

commented Feb 19, 2018

Hi! @MorrisJobke Sure, some pointers wrt the code base would be great to proceed with the fix.

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Feb 20, 2018

Copy from IRC:

on mac the dev setup is a bit harder, but basically it should be this here: https://pad.morrisjobke.de/p/osx-dev

you need a web server that runs the nextcloud server itself first

most of our devs go a different way and use a virtual machine to run linux (because officially macOS is not supported, but it works for most cases)

it's up to you which way you want to go

the VM approach is basically: follow the admin manual to setup the linux server and then mount the folder from you host to the guest machine to be able to use the macOS editors to edit the files

and then you need to build the contacts app

for the contacts app you clone the contacts repo into the app/ folder of your nextcloud server

then you open this contacts app folder and run "make" one time (this fetches all the dependencies and creates the compiled assets)

then you could run "make watch" to run a watch service so that you can edit files and the assets are build automatically

just ask here if you need further details

@rutujasurve94

This comment has been minimized.

Copy link

commented Feb 20, 2018

I followed the steps, installed php7, changed the conf in apache2.conf and git cloned next cloud server, ran the init command, cloned the contacts repo in the apps folder and tried running make
this is the error I get with make: apps rsurve$ cd contacts/
Rutujas-MacBook-Pro:contacts rsurve$ make
make npm
npm run build
make[1]: npm: No such file or directory
make[1]: *** [npm] Error 1
make: *** [build] Error 2

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Feb 20, 2018

You are missing the npm command - have a look at https://docs.npmjs.com/getting-started/installing-node for install instructions.

@rutujasurve94

This comment has been minimized.

Copy link

commented Feb 21, 2018

@MorrisJobke @jancborchardt @skjnldsv I've been able to successfully build the contacts app on my Mac with the guidelines suggested above. I read the thread above, we want to ensure that contact3 (freshly created contact) is used when the user tries to edit. When the 3 new properties wrt address, etc. are added in newContactButton_controller.js, they don't get updated at server side where the contact object is actually created in contact_service.js right? When contactDetails_controller.js tries to get contact details from contacts/js/services/contact_service.js (Line 136) which is contact3, and when we say contact1 === contact2 === contact3, does it mean that all these are the latest updated contact object with the three new fields? contact_service.js has the latest updated contact object till here. But contact4 formed from querying the server: DavClient.getContacts(addressBook, {}, [ contact.data.url ]).then(
function (vcards) { return new Contact(addressBook, vcards[0]); }
needs to be removed and we need to do contacts.put(contact.uid(), contact); of the contact fetched in line 136?
Could you please review my approach and correct me if my understanding of this is wrong somewhere?

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Feb 21, 2018

hey don't get updated at server side where the contact object is actually created in contact_service.js right?

On the server side we use the CardDav backend that is located in the server repo and written in PHP. That means all the JS code is executed on the client side. Sadly I'm not that familiar with the contacts app. Maybe @xh3n1 or @jonatoni can judge a bit better. 🙄

@rutujasurve94

This comment has been minimized.

Copy link

commented Feb 21, 2018

@MorrisJobke sure, thanks a lot

@suntala

This comment has been minimized.

Copy link
Member

commented Mar 18, 2018

@MorrisJobke thank you for creating a guide to setup Nextcloud on a mac. Finding my VM painfully slow, I decided to give it a try. I followed the instructions on https://pad.morrisjobke.de/p/osx-dev, but I am still being told to update my PHP version.

I wasn’t sure what this line in your instructions was saying and so I ignored it: Option 1: put nextcloud in a subdir of your 
Could that be the reason why my setup isn’t working?

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Mar 19, 2018

@suntala The guide installs PHP 5.6 and 7. just run the unlink command for 5.6 and link 7.0. then the correct version should be available

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Mar 19, 2018

And yes you need to put the Nextcloud in a folder that is served by Apache

@suntala

This comment has been minimized.

Copy link
Member

commented Mar 19, 2018

@MorrisJobke thanks for the info. I already did the unlinking and linking. And as for the second point, I assume you mean the instructions that begin with # Set your document root DocumentRoot "/Users/yourmacusernamehere/Projects/nextcloud/", which I also implemented.

@MorrisJobke

This comment has been minimized.

Copy link
Member

commented Mar 20, 2018

@MorrisJobke thanks for the info. I already did the unlinking and linking. And as for the second point, I assume you mean the instructions that begin with # Set your document root DocumentRoot "/Users/yourmacusernamehere/Projects/nextcloud/", which I also implemented.

Mmmh ... I don't understand fully. Could you rephrase it maybe?

@suntala

This comment has been minimized.

Copy link
Member

commented Mar 22, 2018

@MorrisJobke Thanks for getting back to me. I have everything running properly now :)

@suntala

This comment has been minimized.

Copy link
Member

commented Mar 27, 2018

Hi @rutujasurve94, I'm interested in working on this issue and was wondering if you are still working on it.

@joe-pirat

This comment has been minimized.

Copy link

commented Jul 11, 2018

please fix the bug, it makes the experience of nextcloud very unpleasant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.