Skip to content

Commit

Permalink
Don't persist timeout-based opt-out
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Dec 5, 2016
1 parent ba43a91 commit 195c954
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var inquirer = require('inquirer');
var uuid = require('uuid');
var providers = require('./providers');

var temporaryOptOut;

function Insight(options) {
options = options || {};
options.pkg = options.pkg || {};
Expand Down Expand Up @@ -45,7 +47,7 @@ function Insight(options) {

Object.defineProperty(Insight.prototype, 'optOut', {
get: function () {
return this.config.get('optOut');
return temporaryOptOut || this.config.get('optOut');
},
set: function (val) {
this.config.set('optOut', val);
Expand Down Expand Up @@ -155,10 +157,10 @@ Insight.prototype.askPermission = function (msg, cb) {
// stop listening for stdin
prompt.close();

// automatically opt out
this.optOut = true;
// automatically (but temporarily) opt out
temporaryOptOut = true;
cb(null, false);
}.bind(this), this._permissionTimeout * 1000);
}, this._permissionTimeout * 1000);
};

module.exports = Insight;

0 comments on commit 195c954

Please sign in to comment.