mirror of https://github.com/vector-im/riot-web
Merge pull request #1675 from turt2live/travis/fix-granular-again
Fix a couple more issues with granular settingspull/21833/head
commit
350dab06a0
|
@ -135,6 +135,10 @@ const Notifier = {
|
|||
const plaf = PlatformPeg.get();
|
||||
if (!plaf) return;
|
||||
|
||||
// Dev note: We don't set the "notificationsEnabled" setting to true here because it is a
|
||||
// calculated value. It is determined based upon whether or not the master rule is enabled
|
||||
// and other flags. Setting it here would cause a circular reference.
|
||||
|
||||
Analytics.trackEvent('Notifier', 'Set Enabled', enable);
|
||||
|
||||
// make sure that we persist the current setting audio_enabled setting
|
||||
|
@ -168,7 +172,7 @@ const Notifier = {
|
|||
});
|
||||
// clear the notifications_hidden flag, so that if notifications are
|
||||
// disabled again in the future, we will show the banner again.
|
||||
this.setToolbarHidden(false);
|
||||
this.setToolbarHidden(true);
|
||||
} else {
|
||||
dis.dispatch({
|
||||
action: "notifier_enabled",
|
||||
|
|
|
@ -96,6 +96,8 @@ const commands = {
|
|||
colorScheme.primary_color = matches[1];
|
||||
if (matches[4]) {
|
||||
colorScheme.secondary_color = matches[4];
|
||||
} else {
|
||||
colorScheme.secondary_color = colorScheme.primary_color;
|
||||
}
|
||||
return success(
|
||||
SettingsStore.setValue("roomColor", roomId, SettingLevel.ROOM_ACCOUNT, colorScheme),
|
||||
|
|
|
@ -222,9 +222,9 @@ export default class SettingsStore {
|
|||
|
||||
if (explicit) {
|
||||
const handler = handlers[level];
|
||||
if (!handler) return SettingsStore._tryControllerOverride(settingName, level, roomId, null);
|
||||
if (!handler) return SettingsStore._tryControllerOverride(settingName, level, roomId, null, null);
|
||||
const value = handler.getValue(settingName, roomId);
|
||||
return SettingsStore._tryControllerOverride(settingName, level, roomId, value);
|
||||
return SettingsStore._tryControllerOverride(settingName, level, roomId, value, level);
|
||||
}
|
||||
|
||||
for (let i = minIndex; i < levelOrder.length; i++) {
|
||||
|
@ -234,17 +234,17 @@ export default class SettingsStore {
|
|||
|
||||
const value = handler.getValue(settingName, roomId);
|
||||
if (value === null || value === undefined) continue;
|
||||
return SettingsStore._tryControllerOverride(settingName, level, roomId, value);
|
||||
return SettingsStore._tryControllerOverride(settingName, level, roomId, value, levelOrder[i]);
|
||||
}
|
||||
|
||||
return SettingsStore._tryControllerOverride(settingName, level, roomId, null);
|
||||
return SettingsStore._tryControllerOverride(settingName, level, roomId, null, null);
|
||||
}
|
||||
|
||||
static _tryControllerOverride(settingName, level, roomId, calculatedValue) {
|
||||
static _tryControllerOverride(settingName, level, roomId, calculatedValue, calculatedAtLevel) {
|
||||
const controller = SETTINGS[settingName].controller;
|
||||
if (!controller) return calculatedValue;
|
||||
|
||||
const actualValue = controller.getValueOverride(level, roomId, calculatedValue);
|
||||
const actualValue = controller.getValueOverride(level, roomId, calculatedValue, calculatedAtLevel);
|
||||
if (actualValue !== undefined && actualValue !== null) return actualValue;
|
||||
return calculatedValue;
|
||||
}
|
||||
|
|
|
@ -35,11 +35,11 @@ function isMasterRuleEnabled() {
|
|||
}
|
||||
|
||||
export class NotificationsEnabledController extends SettingController {
|
||||
getValueOverride(level, roomId, calculatedValue) {
|
||||
getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) {
|
||||
const Notifier = require('../../Notifier'); // avoids cyclical references
|
||||
if (!Notifier.isPossible()) return false;
|
||||
|
||||
if (calculatedValue === null) {
|
||||
if (calculatedValue === null || calculatedAtLevel === "default") {
|
||||
return isMasterRuleEnabled();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,11 @@ export default class SettingController {
|
|||
* @param {String} roomId The room ID, may be null.
|
||||
* @param {*} calculatedValue The value that the handlers think the setting should be,
|
||||
* may be null.
|
||||
* @param {string} calculatedAtLevel The level for which the calculated value was
|
||||
* calculated at. May be null.
|
||||
* @return {*} The value that should be used, or null if no override is applicable.
|
||||
*/
|
||||
getValueOverride(level, roomId, calculatedValue) {
|
||||
getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) {
|
||||
return null; // no override
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue