These are chat archives for reactioncommerce/reaction

17th
Mar 2015
Bogi
@boboci9
Mar 17 2015 11:57
Hi Aaron, it there any reason why the userId in the Accounts collection is not set?
Bogi
@boboci9
Mar 17 2015 13:56
Can you tell me why do we need both userId and sessionId when we update an address in the Accounts? For every session we will have a different Account document?
Aaron Judd
@aaronjudd
Mar 17 2015 15:13
@boboci9 I have a long list of TODO reactioncommerce/reaction-core#111
the Accounts .userId gets populated if you are user when you checkout (or add an address) but not as a guest
What doesn't happen right now, is I'm not merging accounts that have used the same email into a single "account" if they have previously used this email as a guest, but the guest has converted to user
so.. sessionId = guest, userId= authenticated.
Aaron Judd
@aaronjudd
Mar 17 2015 15:20
but not every session will get an account (only if they start checkout process)
Bogi
@boboci9
Mar 17 2015 15:24
but If I'm logged in I should have automatically an account with userId populated, no?
Aaron Judd
@aaronjudd
Mar 17 2015 15:31
eventually (that's what the todo is about) - but now- currently its only created if you've checked out (since there is nowhere else yet to add that information) . Just need to add editing to the accounts view page
what are you thinking of? do you have a particular scenario in mind? At the moment an account only gets created in checkout - we have to decide what happens to a newly "minted" user - do they get an empty account record, or do we wait to create that until some details are added. I suppose it makes sense to create Account upon create user, if just want to object to exist - but there's not a need for it in the current flow
Bogi
@boboci9
Mar 17 2015 15:38
I'm refactoring my old packages because they used both customer collection and also the user address and profile data
But I think I will need the Account information after the user is created
Because I have profile packages and stuff like that which needs the profile object
Aaron Judd
@aaronjudd
Mar 17 2015 15:40
can you move that all into Accounts?
Bogi
@boboci9
Mar 17 2015 15:40
yes
But in case I have a user is it enough if I work with the findOne({'userId':currentUser}) without any session condition?
Aaron Judd
@aaronjudd
Mar 17 2015 15:40
yes
take a look at the 'accounts' publication
it's filtered on the front end, but for server methods use Accounts.find userId: @userId, shopId: shopId
Bogi
@boboci9
Mar 17 2015 15:44
yes thanks
are there plans to create the account when the user is created?
I can help you with that since I will have to add it in my app anyways so that I don't run in any errors
Aaron Judd
@aaronjudd
Mar 17 2015 15:49
yes, we could do that. just be aware of the guest flow -> if there were previous orders made with the same email as the userId /account created, they’ll need to confirm the email before we merge existing orders into the created account.
Bogi
@boboci9
Mar 17 2015 15:51
do you have any checks like this in the code?
I also noticed that sometimes I click on checkout with a logged in user and it asks me to log in again
Aaron Judd
@aaronjudd
Mar 17 2015 15:55
re: the accounts I was going to do that pretty quickly - I wanted to get these updates out to everyone (for this kind of feedback). let me make the changes to create the account on new user (should be quick, and I was going to look at it in #304 anyways)
account.coffee “Accounts.onCreateUser”
Bogi
@boboci9
Mar 17 2015 15:56
and once I log in two Accounts are created one with session and userId and one with same userId and null for sessionId
Aaron Judd
@aaronjudd
Mar 17 2015 15:56
I’ll just copy profile info into accounts
re: two: one session is for when you log out
Bogi
@boboci9
Mar 17 2015 15:57
ok thanks I will wait for your changes
but in this case if I make an Accounts.find(by userId and shopId) two records are returned
Aaron Judd
@aaronjudd
Mar 17 2015 16:00
that doesn’t seem right. Let me run through a few and see if I can duplicate that. Should be only one user cart, but need to look at what the account behaviour is - you might be on to something there ;-)
re: checkout asking to login again - I haven’t seen that (could be part of the accounts problem)
Bogi
@boboci9
Mar 17 2015 16:03
ok thanks, I will wait for your input than :)
Aaron Judd
@aaronjudd
Mar 17 2015 16:04
ok - taking a look into this now
Aaron Judd
@aaronjudd
Mar 17 2015 16:09
anything else that you are putting into accounts on creation that I should consider?
Bogi
@boboci9
Mar 17 2015 16:10
not sure which name is used by you, I usually use profile.name in my packages
Aaron Judd
@aaronjudd
Mar 17 2015 16:11
I kept that
so I’ll just be moving “profile” from user to accounts, so that swap is easy
keeping the same structure
Bogi
@boboci9
Mar 17 2015 16:11
ok, thanks that's perfect for me
Aaron Judd
@aaronjudd
Mar 17 2015 18:50
@boboci9 might take a bit - i’m fixing a few other items along the way to get there.
Spencer Norman
@spencern
Mar 17 2015 20:04
How can I run the tests in reaction-core? Have tried meteor test-packages ./, meteor --test, and running mocha separately
Aaron Judd
@aaronjudd
Mar 17 2015 21:58
@spencern uncomment the `velocity’ test packages in the app (mocha, jasmine) and add the tests at the app level. I’ve been waiting for a patch that was merged into velocity that will allow the tests at the package level, it’s on my short list to check back on that (I’ll start adding tests into the repo after that starts working)
feel free to add your experience to #241