Skip to content

Commit ca1e326

Browse files
committed
Code cleanup.
1 parent 022091a commit ca1e326

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/scripts/extensions/authenticationHelper.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,8 @@ export class AuthenticationHelper {
5353
}
5454

5555
let getUserInformationFunction = () => {
56-
return new Promise<ResponsePackage<string>>((resolve2, reject2) => {
57-
this.getClipperInfoCookie(clipperId).then((cookie) => {
58-
this.retrieveUserInformation(clipperId, cookie).then((result) => {
59-
resolve2(result);
60-
}, (errorObject) => {
61-
reject2(errorObject);
62-
});
63-
});
56+
return this.getClipperInfoCookie(clipperId).then((cookie) => {
57+
return this.retrieveUserInformation(clipperId, cookie);
6458
});
6559
};
6660

@@ -79,15 +73,15 @@ export class AuthenticationHelper {
7973
this.user.set({ updateReason: updateReason, writeableCookies: writeableCookies });
8074
}
8175

82-
resolve(this.user.get());
8376
}, (error: OneNoteApi.GenericError) => {
8477
getInfoEvent.setStatus(Log.Status.Failed);
8578
getInfoEvent.setFailureInfo(error);
8679

8780
this.user.set({ updateReason: updateReason });
88-
resolve(this.user.get());
8981
}).then(() => {
9082
this.logger.logEvent(getInfoEvent);
83+
84+
resolve(this.user.get());
9185
});
9286
});
9387
}
@@ -186,9 +180,10 @@ export class AuthenticationHelper {
186180
}
187181

188182
/**
189-
* Determins whether or not the given string is valid JSON and has the flag which lets us know if cookies are enabled.
183+
* Determines whether or not the given string is valid JSON and has the flag which lets us know if cookies are enabled.
190184
*/
191185
protected isThirdPartyCookiesEnabled(userInfo: UserInfoData): boolean {
192-
return userInfo.cookieInRequest;
186+
// Note that we are returning true by default to ensure the N-1 scenario.
187+
return userInfo.cookieInRequest ? userInfo.cookieInRequest : true;
193188
}
194189
}

0 commit comments

Comments
 (0)