Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Ask for event tracking opt-in only in interactive commands #376

Merged
merged 1 commit into from
May 20, 2020

Conversation

vgrichina
Copy link
Contributor

For now this includes:

  • near login
  • near dev-deploy

Related to #306

This change had to be done to make sure that opt-in flow doesn't interfere with usage in scripts.

For now this includes:
 - near login
 - near dev-deploy
@@ -9,47 +9,14 @@ const settings = require('./settings');
const TRACKING_ENABLED_KEY = 'trackingEnabled';
const TRACKING_SESSION_ID_KEY = 'trackingSessionId';

const shouldOptInByDefault = () => {
const isGitPod = !!process.env.GITPOD_WORKSPACE_URL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do just process.env.GITPOD_WORKSPACE_URL?

Copy link
Contributor Author

@vgrichina vgrichina May 20, 2020

Choose a reason for hiding this comment

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

in this case we can, however it's pretty commonly used for explicit cast to boolean: https://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript

main difference is if somebody downstream uses return value outside of logical operation (e.g. shouldOptInByDefault() === true or shouldOptInByDefault().toString() – this can fail in unexpected way if not coerced into boolean here

I'd prefer to keep it as is because we return value outside of function (and it is reasonable for caller to expect it is boolean)

@vgrichina vgrichina merged commit 932bc73 into master May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants