These are chat archives for reactioncommerce/reaction

21st
Sep 2015
Aaron Judd
@aaronjudd
Sep 21 2015 04:46
@Aesop7 :+1: that’s the ticket.
Bogi
@boboci9
Sep 21 2015 11:40

Hi @aaronjudd, I am trying to log in with an admin user of mine, the user and roles are all created correctly but in the

Accounts.onLogin(function (options, user) {

  if (options.type !== 'anonymous' && options.type !== 'resume') {
    var update = {
      $pullAll: {}
    };
    update.$pullAll['roles.' + ReactionCore.getShopId()] = ['anonymous'];

    // remove anonymous role
    Meteor.users.update({
      _id: options.user._id
    }, update, {
      multi: true
    });
    ReactionCore.Events.info("removed anonymous role from user: " + options.user._id);

    // logged in users need an additonal worfklow push to get started with checkoutLogin
    return Meteor.call("workflow/pushCartWorkflow", "coreCartWorkflow", "checkoutLogin");
  }

});

in the last row when you call workflow/pushCartWorkflow the Meteor.userId() is not yet defined and it is used inside the workflow/pushCartWorkflow function which will trow an error and won't log the user in. The issue is the Cart entry won't get created because the workflow/pushCartWorkflow is called from the Account.onLogin when the Meteor.userId() is not yet set and

 var currentCart = Cart.findOne({
      'userId': Meteor.userId()
    });

    // exit if a cart doesn't exist.
    if (!currentCart) return;

will return before anything from the workflow/pushCartWorkflow

Bogi
@boboci9
Sep 21 2015 13:49
neither is the Meteor.userId set in the ReactionCore.hasPermission function which is also called in the workflow/pushCartWorkflow
Aaron Judd
@aaronjudd
Sep 21 2015 14:02
you have options.user._id as the userId in .onLogin, but yeah, the workflow needs to initialize somewhere else, and was getting ready to look at this bug (where the state for logged in users is not always correct on cart entry (if you refresh it will be though, or if you push the workflow once more)
I don’t think that call should reside there anyhow - cart state and user state should be independent… don’t you agree?
Bogi
@boboci9
Sep 21 2015 14:20
I am still trying to get a hang of the new version, not sure that workflow/pushCartWorkflow should be there in the onLogin function but I'm not sure I see the whole picture in the new version yet
Bogi
@boboci9
Sep 21 2015 14:31
This message was deleted
Bogi
@boboci9
Sep 21 2015 14:42
refresh works for now I was missing a role
Aaron Judd
@aaronjudd
Sep 21 2015 16:03
@boboci9 @spencern is the new workflow making sense though? I know there are a couple places I’m still tuning… but overall, does it work for your uses cases
Bogi
@boboci9
Sep 21 2015 16:05
I couldn't check the multi vendor use cases yet, I have to redo some cases to start that setup, for single shop setup it seems to be working though
Aaron Judd
@aaronjudd
Sep 21 2015 16:07
ok, well - the good news is that I don't see it getting any more dramatic overhauls - we always knew that statemachine code wouldn't last though
Bryan Wu
@cooloney
Sep 21 2015 20:56
While building the application:
settings/reaction.import.less:11:1: Less compiler error: 'custom.bootstrap.less' wasn't found
Hi, did someone meet such build failure issue before?
Aaron Judd
@aaronjudd
Sep 21 2015 20:59
that file should get generated in client/themes/bootstrap. There should also exist some *.json files in that directory. any chance those json files aren’t there?
Bryan Wu
@cooloney
Sep 21 2015 21:03
settings/dev.sample.json is there, but everything is empty.
any validate sample json file for me to take a look? @aaronjudd thanks,
Bryan Wu
@cooloney
Sep 21 2015 21:05
I used clone-packages.sh to clone all the source and use bin/reset to remove all the files.
this might cause that error.
@aaronjudd great, then I need copy over those 2 jsons to like settings.json or just copy these 2 files to settings/
Aaron Judd
@aaronjudd
Sep 21 2015 21:06
bin/reset should leave those files just fine but it will remove any existing .less files, and as long as those two files exist (in client/themes/bootstrap, then the theme less files will get recreated
Bryan Wu
@cooloney
Sep 21 2015 21:09
21:08:28.272Z INFO core: No configuration loaded from settings/reaction.json. { [Error: Unknown asset: settings/reaction.json] stack: [Getter] }
Does this message mean I need create my own reaction.json? or I can copy over from customer.reaction.json?
Aaron Judd
@aaronjudd
Sep 21 2015 21:10
that’s fine - not a warning, just “Info”. (it’s another place to add pre-configuration).
you don’t need to do anything with that
Bryan Wu
@cooloney
Sep 21 2015 21:10
OK, thanks.