hotkeys: Replace C with x for composing PM.

Pressing the 'x' key can now be used to compose a PM.
Pressing the 'C' key displays a modal that shows a deprecation notice.

Fixes #6548.
This commit is contained in:
Anurag Sharma
2018-02-08 19:47:26 +05:30
committed by Tim Abbott
parent af004fa6f5
commit 1227857de6
14 changed files with 58 additions and 15 deletions

View File

@@ -122,6 +122,27 @@ exports.show_failed_message_success = function (message_id) {
});
};
exports.maybe_show_deprecation_notice = function (key) {
var message;
if (key === 'C') {
message = i18n.t('We\'ve replaced the "C" hotkey with "x" to make this common shortcut easier to trigger.');
} else {
// should never get here
return;
}
var shown_deprecation_notices = JSON.parse(localStorage.getItem('shown_deprecation_notices'));
if (shown_deprecation_notices === null) {
shown_deprecation_notices = [];
}
if (shown_deprecation_notices.indexOf(key) === -1) {
$('#deprecation-notice-modal').modal('show');
$('#deprecation-notice-message').text(message);
shown_deprecation_notices.push(key);
localStorage.setItem('shown_deprecation_notices', JSON.stringify(shown_deprecation_notices));
}
};
/* EXPERIMENTS */
/* This method allows an advanced user to use the console