aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-30 16:24:51 -0400
committerGitHub <noreply@github.com>2020-05-30 16:24:51 -0400
commitce7f9dd09a85f182a9ea98c3366bed6c2ecbb1b4 (patch)
tree308c9faacad6f3080cc1995bae27090e61501937 /ext/bg
parent976a200ffc65e94f0246392f6b29505f1eb4f16c (diff)
Update how assignment of general.enableClipboardPopups works (#583)
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/settings/clipboard-popups-controller.js25
1 files changed, 8 insertions, 17 deletions
diff --git a/ext/bg/js/settings/clipboard-popups-controller.js b/ext/bg/js/settings/clipboard-popups-controller.js
index 77fae305..294663f9 100644
--- a/ext/bg/js/settings/clipboard-popups-controller.js
+++ b/ext/bg/js/settings/clipboard-popups-controller.js
@@ -36,25 +36,16 @@ class ClipboardPopupsController {
}
async _onEnableClipboardPopupsChanged(e) {
- const enableClipboardPopups = e.target.checked;
- const options = await this._settingsController.getOptionsMutable();
-
- if (enableClipboardPopups) {
- options.general.enableClipboardPopups = await new Promise((resolve) => {
- chrome.permissions.request(
- {permissions: ['clipboardRead']},
- (granted) => {
- if (!granted) {
- this._checkbox.checked = false;
- }
- resolve(granted);
- }
- );
+ const checkbox = e.currentTarget;
+ let value = checkbox.checked;
+
+ if (value) {
+ value = await new Promise((resolve) => {
+ chrome.permissions.request({permissions: ['clipboardRead']}, resolve);
});
- } else {
- options.general.enableClipboardPopups = false;
+ checkbox.checked = value;
}
- await this._settingsController.save();
+ await this._settingsController.setProfileSetting('general.enableClipboardPopups', value);
}
}