From 275a6022742fc2aa2691fd0bafa24bd0cd587839 Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Tue, 5 Aug 2014 16:13:54 +0200 Subject: [PATCH 1/2] [WO-490] add bug reporting to error dialog --- src/js/app-controller.js | 1 + src/js/controller/account.js | 1 + src/js/controller/contacts.js | 3 ++- src/js/controller/login-initial.js | 2 ++ src/js/controller/login-privatekey-download.js | 10 ++++++++-- src/js/controller/privatekey-upload.js | 6 ++++-- src/js/controller/set-passphrase.js | 3 ++- src/js/util/error.js | 1 + src/sass/views/_dialog.scss | 2 +- src/tpl/add-account.html | 2 +- src/tpl/dialog.html | 1 + src/tpl/navigation.html | 2 +- 12 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/js/app-controller.js b/src/js/app-controller.js index 71d4d80..c567c5c 100644 --- a/src/js/app-controller.js +++ b/src/js/app-controller.js @@ -89,6 +89,7 @@ define(function(require) { message: message, positiveBtnStr: str.updatePublicKeyPosBtn, negativeBtnStr: str.updatePublicKeyNegBtn, + showBugReporter: false, showNegativeBtn: true, callback: callback }); diff --git a/src/js/controller/account.js b/src/js/controller/account.js index da29625..fbfcd90 100644 --- a/src/js/controller/account.js +++ b/src/js/controller/account.js @@ -65,6 +65,7 @@ define(function(require) { $scope.state.account.toggle(false); $scope.$apply(); $scope.onError({ + showBugReporter: false, title: 'Success', message: 'Exported keypair to file.' }); diff --git a/src/js/controller/contacts.js b/src/js/controller/contacts.js index f66f01e..10cd441 100644 --- a/src/js/controller/contacts.js +++ b/src/js/controller/contacts.js @@ -61,7 +61,8 @@ define(function(require) { // verifiy public key string if (publicKeyArmored.indexOf('-----BEGIN PGP PUBLIC KEY BLOCK-----') < 0) { $scope.onError({ - errMsg: 'Invalid public key!' + showBugReporter: false, + message: 'Invalid public key!' }); return; } diff --git a/src/js/controller/login-initial.js b/src/js/controller/login-initial.js index 02c896d..3436e47 100644 --- a/src/js/controller/login-initial.js +++ b/src/js/controller/login-initial.js @@ -25,6 +25,7 @@ define(function(require) { $scope.importKey = function() { if (!$scope.state.agree) { $scope.onError({ + showBugReporter: false, message: termsMsg }); return; @@ -42,6 +43,7 @@ define(function(require) { $scope.setPassphrase = function() { if (!$scope.state.agree) { $scope.onError({ + showBugReporter: false, message: termsMsg }); return; diff --git a/src/js/controller/login-privatekey-download.js b/src/js/controller/login-privatekey-download.js index 481d093..81406cb 100644 --- a/src/js/controller/login-privatekey-download.js +++ b/src/js/controller/login-privatekey-download.js @@ -32,7 +32,10 @@ define(function(require) { $scope.verifyRecoveryToken = function(callback) { if (!$scope.recoveryToken) { - $scope.onError(new Error('Please set the recovery token!')); + $scope.onError({ + message: 'Please set the recovery token!', + showBugReporter: false + }); return; } @@ -65,7 +68,10 @@ define(function(require) { var inputCode = '' + $scope.code0 + $scope.code1 + $scope.code2 + $scope.code3 + $scope.code4 + $scope.code5; if (!inputCode) { - $scope.onError(new Error('Please enter the keychain code!')); + $scope.onError({ + message: 'Please enter the keychain code!', + showBugReporter: false + }); return; } diff --git a/src/js/controller/privatekey-upload.js b/src/js/controller/privatekey-upload.js index 7ba31fa..d84af5b 100644 --- a/src/js/controller/privatekey-upload.js +++ b/src/js/controller/privatekey-upload.js @@ -27,7 +27,8 @@ define(function(require) { // show message $scope.onError({ title: 'Info', - message: 'Your PGP key has already been synced.' + message: 'Your PGP key has already been synced.', + showBugReporter: false }); return; } @@ -181,7 +182,8 @@ define(function(require) { // show success message $scope.onError({ title: 'Success', - message: 'Whiteout Keychain setup successful!' + message: 'Whiteout Keychain setup successful!', + showBugReporter: false }); }); }); diff --git a/src/js/controller/set-passphrase.js b/src/js/controller/set-passphrase.js index 13fc7ad..c952a6d 100644 --- a/src/js/controller/set-passphrase.js +++ b/src/js/controller/set-passphrase.js @@ -74,7 +74,8 @@ define(function(require) { $scope.$apply(); $scope.onError({ title: 'Success', - message: 'Passphrase change complete.' + message: 'Passphrase change complete.', + showBugReporter: false }); } }; diff --git a/src/js/util/error.js b/src/js/util/error.js index 8eac76f..872d919 100644 --- a/src/js/util/error.js +++ b/src/js/util/error.js @@ -21,6 +21,7 @@ define(function(require) { positiveBtnStr: options.positiveBtnStr || 'Ok', negativeBtnStr: options.negativeBtnStr || 'Cancel', showNegativeBtn: options.showNegativeBtn || false, + showBugReporter: (typeof options.showBugReporter !== 'undefined' ? options.showBugReporter : true), callback: options.callback }; // don't call apply for synchronous calls diff --git a/src/sass/views/_dialog.scss b/src/sass/views/_dialog.scss index da28db2..370230e 100644 --- a/src/sass/views/_dialog.scss +++ b/src/sass/views/_dialog.scss @@ -13,7 +13,7 @@ .control { button { - width: 100px; + min-width: 100px; } } } \ No newline at end of file diff --git a/src/tpl/add-account.html b/src/tpl/add-account.html index c4493c8..1c0df1b 100644 --- a/src/tpl/add-account.html +++ b/src/tpl/add-account.html @@ -6,7 +6,7 @@
  • Google Mail
  • -
  • +
  • Whiteout Mailbox
  • diff --git a/src/tpl/dialog.html b/src/tpl/dialog.html index bfbcb1f..ac03d1e 100644 --- a/src/tpl/dialog.html +++ b/src/tpl/dialog.html @@ -7,6 +7,7 @@

    {{state.dialog.message}} Learn more

    +
    diff --git a/src/tpl/navigation.html b/src/tpl/navigation.html index 8cc64e2..32f9f5c 100644 --- a/src/tpl/navigation.html +++ b/src/tpl/navigation.html @@ -18,7 +18,7 @@
  • Account
  • Contacts
  • Key sync (experimental)
  • -
  • Report a bug +
  • Report a bug
  • About
  • From 0e21616911c35bc9041aaa0847d2cc77cfa5fcee Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Tue, 12 Aug 2014 18:32:37 +0200 Subject: [PATCH 2/2] Cleanup bug reporter button --- src/js/app-controller.js | 1 - src/js/controller/account.js | 1 - src/js/controller/login-initial.js | 2 -- src/js/controller/login-privatekey-download.js | 10 ++-------- src/js/controller/privatekey-upload.js | 6 ++---- src/js/controller/set-passphrase.js | 4 ++-- src/js/util/error.js | 2 +- src/tpl/add-account.html | 2 +- src/tpl/dialog.html | 5 +++-- 9 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/js/app-controller.js b/src/js/app-controller.js index c567c5c..71d4d80 100644 --- a/src/js/app-controller.js +++ b/src/js/app-controller.js @@ -89,7 +89,6 @@ define(function(require) { message: message, positiveBtnStr: str.updatePublicKeyPosBtn, negativeBtnStr: str.updatePublicKeyNegBtn, - showBugReporter: false, showNegativeBtn: true, callback: callback }); diff --git a/src/js/controller/account.js b/src/js/controller/account.js index fbfcd90..da29625 100644 --- a/src/js/controller/account.js +++ b/src/js/controller/account.js @@ -65,7 +65,6 @@ define(function(require) { $scope.state.account.toggle(false); $scope.$apply(); $scope.onError({ - showBugReporter: false, title: 'Success', message: 'Exported keypair to file.' }); diff --git a/src/js/controller/login-initial.js b/src/js/controller/login-initial.js index 3436e47..02c896d 100644 --- a/src/js/controller/login-initial.js +++ b/src/js/controller/login-initial.js @@ -25,7 +25,6 @@ define(function(require) { $scope.importKey = function() { if (!$scope.state.agree) { $scope.onError({ - showBugReporter: false, message: termsMsg }); return; @@ -43,7 +42,6 @@ define(function(require) { $scope.setPassphrase = function() { if (!$scope.state.agree) { $scope.onError({ - showBugReporter: false, message: termsMsg }); return; diff --git a/src/js/controller/login-privatekey-download.js b/src/js/controller/login-privatekey-download.js index 81406cb..481d093 100644 --- a/src/js/controller/login-privatekey-download.js +++ b/src/js/controller/login-privatekey-download.js @@ -32,10 +32,7 @@ define(function(require) { $scope.verifyRecoveryToken = function(callback) { if (!$scope.recoveryToken) { - $scope.onError({ - message: 'Please set the recovery token!', - showBugReporter: false - }); + $scope.onError(new Error('Please set the recovery token!')); return; } @@ -68,10 +65,7 @@ define(function(require) { var inputCode = '' + $scope.code0 + $scope.code1 + $scope.code2 + $scope.code3 + $scope.code4 + $scope.code5; if (!inputCode) { - $scope.onError({ - message: 'Please enter the keychain code!', - showBugReporter: false - }); + $scope.onError(new Error('Please enter the keychain code!')); return; } diff --git a/src/js/controller/privatekey-upload.js b/src/js/controller/privatekey-upload.js index d84af5b..7ba31fa 100644 --- a/src/js/controller/privatekey-upload.js +++ b/src/js/controller/privatekey-upload.js @@ -27,8 +27,7 @@ define(function(require) { // show message $scope.onError({ title: 'Info', - message: 'Your PGP key has already been synced.', - showBugReporter: false + message: 'Your PGP key has already been synced.' }); return; } @@ -182,8 +181,7 @@ define(function(require) { // show success message $scope.onError({ title: 'Success', - message: 'Whiteout Keychain setup successful!', - showBugReporter: false + message: 'Whiteout Keychain setup successful!' }); }); }); diff --git a/src/js/controller/set-passphrase.js b/src/js/controller/set-passphrase.js index c952a6d..7b1a98b 100644 --- a/src/js/controller/set-passphrase.js +++ b/src/js/controller/set-passphrase.js @@ -48,6 +48,7 @@ define(function(require) { function onPassphraseChanged(err, newPrivateKeyArmored) { if (err) { + err.showBugReporter = false; $scope.onError(err); return; } @@ -74,8 +75,7 @@ define(function(require) { $scope.$apply(); $scope.onError({ title: 'Success', - message: 'Passphrase change complete.', - showBugReporter: false + message: 'Passphrase change complete.' }); } }; diff --git a/src/js/util/error.js b/src/js/util/error.js index 872d919..965557b 100644 --- a/src/js/util/error.js +++ b/src/js/util/error.js @@ -21,7 +21,7 @@ define(function(require) { positiveBtnStr: options.positiveBtnStr || 'Ok', negativeBtnStr: options.negativeBtnStr || 'Cancel', showNegativeBtn: options.showNegativeBtn || false, - showBugReporter: (typeof options.showBugReporter !== 'undefined' ? options.showBugReporter : true), + showBugReporter: (typeof options.showBugReporter !== 'undefined' ? options.showBugReporter : !options.title), // if title is set, presume it's not an error by default callback: options.callback }; // don't call apply for synchronous calls diff --git a/src/tpl/add-account.html b/src/tpl/add-account.html index 1c0df1b..c4493c8 100644 --- a/src/tpl/add-account.html +++ b/src/tpl/add-account.html @@ -6,7 +6,7 @@
  • Google Mail
  • -
  • +
  • Whiteout Mailbox
  • diff --git a/src/tpl/dialog.html b/src/tpl/dialog.html index ac03d1e..9fef31b 100644 --- a/src/tpl/dialog.html +++ b/src/tpl/dialog.html @@ -7,9 +7,10 @@

    {{state.dialog.message}} Learn more

    - - + + +
    \ No newline at end of file