MDL-67853 message: Remove on/offline settings on message preferences

This commit is contained in:
Pau Ferrer Ocaña
2022-01-27 15:22:15 +01:00
parent e8ad1eaa43
commit d74bd798b6
44 changed files with 696 additions and 682 deletions
+6 -35
View File
@@ -21,11 +21,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery'], function($) {
var SELECTORS = {
STATE_NONE: '[data-state="none"]',
STATE_BOTH: '[data-state="both"]',
STATE_LOGGED_IN: '[data-state="loggedin"]',
STATE_LOGGED_OFF: '[data-state="loggedoff"]',
const SELECTORS = {
STATE_INPUTS: '.preference-state input.notification_enabled'
};
/**
@@ -34,7 +31,7 @@ define(['jquery'], function($) {
* @class
* @param {object} element jQuery object root element of the processor
*/
var NotificationProcessor = function(element) {
const NotificationProcessor = function(element) {
this.root = $(element);
};
@@ -54,36 +51,10 @@ define(['jquery'], function($) {
* @method isLoggedInEnabled
* @return {bool}
*/
NotificationProcessor.prototype.isLoggedInEnabled = function() {
var none = this.root.find(SELECTORS.STATE_NONE).find('input');
NotificationProcessor.prototype.isEnabled = function() {
const enabled = this.root.find(SELECTORS.STATE_INPUTS);
if (none.prop('checked')) {
return false;
}
var both = this.root.find(SELECTORS.STATE_BOTH).find('input');
var loggedIn = this.root.find(SELECTORS.STATE_LOGGED_IN).find('input');
return loggedIn.prop('checked') || both.prop('checked');
};
/**
* Check if the processor is enabled when the user is logged out.
*
* @method isLoggedOffEnabled
* @return {bool}
*/
NotificationProcessor.prototype.isLoggedOffEnabled = function() {
var none = this.root.find(SELECTORS.STATE_NONE).find('input');
if (none.prop('checked')) {
return false;
}
var both = this.root.find(SELECTORS.STATE_BOTH).find('input');
var loggedOff = this.root.find(SELECTORS.STATE_LOGGED_OFF).find('input');
return loggedOff.prop('checked') || both.prop('checked');
return enabled.prop('checked');
};
return NotificationProcessor;