Skip to content

In chat hooks should not inject the user_id into context manually #99

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

Open
carmenlau opened this issue Feb 14, 2018 · 0 comments
Open
Assignees

Comments

@carmenlau
Copy link
Contributor

Now we inject the user id this way in chat sdk.

function chatHook(name, func) {
  skygearCloud.op('chat:' + name + '_hook', function (param, options) {
    const context = {userId: options.context.user_id};
    func(param.args, context);
    return {status: 'ok'};
  }, {
    userRequired: true,
    keyRequired: true
  });
}

That will have 2 problems

  1. User will be confusion how to get the user id as it is different from the core lambda
  2. After we add more data to the context, new data will be missed in the message hook. For example, we are going to add user verified flag.

Propose solution:
Should configure the container correctly with user for calling the lambda, should not inject the data manually in sdk

@carmenlau carmenlau changed the title The message hook, instead of injecting the user_id into context In chat hooks should not inject the user_id into context manually Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants