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

L10n of all strings. #18

Merged
merged 5 commits into from
Jun 14, 2023
Merged

L10n of all strings. #18

merged 5 commits into from
Jun 14, 2023

Conversation

dbreese
Copy link
Collaborator

@dbreese dbreese commented Jun 13, 2023

Also refactored OrgUtils to use a reject() when username is not determined.
Also fixed simple lint warnings.

@khawkins @sfdctaka @maliroteh-sf

@dbreese dbreese requested a review from a team as a code owner June 13, 2023 13:33
import { OrgUtils } from '../utils/orgUtils';

export class AuthorizeCommand {
static async authorizeToOrg(): Promise<boolean> {
const user = await OrgUtils.getDefaultUser();
let userAuthorized = false;
await OrgUtils.getDefaultUser()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a strange mix of await and then(). Why are we mixing these two competing design patterns?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe I am not fully understanding the Promise() behavior then. Seems there are two patterns I can use:

try {
  await somePromise()
} catch {
  // it was rejected or some error occurred
}

or just chain them with the .then() and .catch()?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that's correct. Whereas here we're doing await / then(), which is mixing sync and async Promise consumption. We should do one or the other.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I updated!

Copy link
Collaborator

@khawkins khawkins left a comment

Choose a reason for hiding this comment

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

This looks fine overall, but I want to sort the async vs. sync thing before signing off.

Comment on lines +13 to 22
try {
await OrgUtils.getDefaultUser();
return Promise.resolve(true);
} catch {
// Ask user to authorize to an org now only if not authorized yet.
const result = await window.showInformationMessage(
'Do you want to authorize an Org now?',
{ title: 'Authorize' },
{ title: 'No' }
l10n.t('Do you want to authorize an Org now?'),
{ title: l10n.t('Authorize') },
{ title: l10n.t('No') }
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@sfdctaka sfdctaka left a comment

Choose a reason for hiding this comment

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

LGTM!

@dbreese dbreese merged commit 1e23875 into main Jun 14, 2023
17 checks passed
@dbreese dbreese deleted the l10n branch June 14, 2023 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants