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 Mar 25, 2016
1 parent c937a10 commit 017ea6a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var assign = require('object-assign');
var debounce = require('lodash.debounce');
var inquirer = require('inquirer');
var providers = require('./providers');
var temporaryOptOut;

function Insight(options) {
options = options || {};
Expand Down Expand Up @@ -44,7 +45,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 @@ -128,10 +129,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 017ea6a

Please sign in to comment.