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

src/client: fix storing updated token, ensure client config is always an object #437

Merged
merged 2 commits into from
Jul 1, 2016

Conversation

williamboman
Copy link
Member

@williamboman williamboman commented Jun 30, 2016

This also fixes an issue where the token would not be stored in the
user file.

Just want to point out that config !== client.config as well (hence breakage in the first place).

@williamboman williamboman force-pushed the fix/save-token branch 2 times, most recently from e938189 to fbd9db4 Compare June 30, 2016 02:00
@williamboman williamboman changed the title client: pass the updated token as argument to callback src/client: pass the updated token as argument to callback Jun 30, 2016
@astorije
Copy link
Member

@xPaw, do you mind taking a quick look at this one?

@astorije astorije added the Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. label Jun 30, 2016
if (config) {
if (!config.token) {
client.updateToken(function() {
client.manager.updateUser(client.name, {token: config.token});
Copy link
Member

Choose a reason for hiding this comment

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

The problem was specifically this line, which should have been client.config.token.

@xPaw
Copy link
Member

xPaw commented Jun 30, 2016

👍 Good catch. Feel free to fix my comments, if you want to.

@williamboman williamboman force-pushed the fix/save-token branch 2 times, most recently from fd3cb25 to cdb3618 Compare June 30, 2016 10:51
@williamboman williamboman changed the title src/client: pass the updated token as argument to callback src/client: fix storing updated token, add type checks to Client ctor Jun 30, 2016
@williamboman williamboman force-pushed the fix/save-token branch 3 times, most recently from d5c9f1b to a658dc2 Compare June 30, 2016 12:31
@@ -55,6 +55,9 @@ var inputs = [
}, {});

function Client(manager, name, config) {
if (config === undefined || typeof config !== "object") {
Copy link
Member

Choose a reason for hiding this comment

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

undefined isn't an object, so the first check isn't necessary.

delay += 1000;
});

log.info("User '" + name + "' loaded");
Copy link
Member

@xPaw xPaw Jun 30, 2016

Choose a reason for hiding this comment

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

Add a check for name, otherwise it's going to print undefined for users in public mode.

@williamboman williamboman force-pushed the fix/save-token branch 2 times, most recently from bdec503 to 4971d18 Compare June 30, 2016 12:40
@williamboman williamboman changed the title src/client: fix storing updated token, add type checks to Client ctor src/client: fix storing updated token, ensure client config is always an object Jun 30, 2016
@williamboman
Copy link
Member Author

Ok patch should be final now.

@xPaw
Copy link
Member

xPaw commented Jun 30, 2016

Still 👍

This also fixes an issue where the token would not be stored in the
user file.
@astorije astorije self-assigned this Jul 1, 2016
@astorije
Copy link
Member

astorije commented Jul 1, 2016

👍 and merging, thanks!

@astorije astorije merged commit 1cc0222 into thelounge:master Jul 1, 2016
@williamboman williamboman deleted the fix/save-token branch July 1, 2016 11:47
@xPaw xPaw added this to the 2.0.0 milestone Jul 2, 2016
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
src/client: fix storing updated token, ensure client config is always an object
@xPaw xPaw unassigned astorije and xPaw Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants