Skip to content

Commit

Permalink
fix(core): reactive flow
Browse files Browse the repository at this point in the history
  • Loading branch information
balthazar committed Oct 13, 2015
1 parent d87e338 commit 4c0a2fe
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions api/services/github.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ exports.addUserToOrg = (user, org) => {
return q.reject(new Error('Invalid organization.'));
}

const userGithub = new Github({ version: '3.0.0', debug: true });
userGithub.authenticate({ type: 'oauth', token: user.token });

return user.save()
.then(() => {
return q.nfcall(
Expand All @@ -47,33 +50,16 @@ exports.addUserToOrg = (user, org) => {
);
})
.then(() => {

/*
const userGithub = new Github({ version: '3.0.0', debug: true });
userGithub.authenticate({ type: 'oauth', token: user.token });
userGithub.user.listOrganizationMembership({ org: 'KeyCode-5', user: user.name }, function (err, res) {
console.log(err, res);
});
userGithub.orgs.publicizeMembership({ org: 'KeyCode-5', user: user.name }, function (err, res) {
console.log(err, res);
});
userGithub.user.editOrganizationMembership({ org: 'KeyCode-5', state: 'active' }, (err, res) => {
console.log(err, res);
});
github.orgs.addTeamMember({ id: config.orgIds[org], user: user.name }, (err, res) => {
console.log(err, res);
});
userGithub.user.listOrganizationMembership({ org: 'KeyCode-5', user: user.name }, function (err, res) {
console.log(err, res);
});
*/
return null;
return q.nfcall(
userGithub.user.editOrganizationMembership,
{ org: `KeyCode-${org}`, state: 'active' }
);
})
.then(() => {
return q.nfcall(
userGithub.orgs.publicizeMembership,
{ org: `KeyCode-${org}`, user: user.name }
);
});

};
Expand Down

4 comments on commit 4c0a2fe

@meriadec
Copy link
Member

Choose a reason for hiding this comment

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

do this work? :p

@balthazar
Copy link
Member Author

Choose a reason for hiding this comment

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

Try it

@meriadec
Copy link
Member

Choose a reason for hiding this comment

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

but i dont know if it's deployed

@balthazar
Copy link
Member Author

Choose a reason for hiding this comment

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

It is

Please sign in to comment.