Merge pull request #4775 from matrix-org/t3chguy/notifications0
Fix Field ts def, fix LocalEchoWrapper and NotificationsEnabledControllerpull/21833/head
commit
9a85b82007
|
@ -18,7 +18,7 @@ import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import {IFieldState, IValidationResult} from "../elements/Validation";
|
import {IFieldState, IValidationResult} from "./Validation";
|
||||||
|
|
||||||
// Invoke validation from user input (when typing, etc.) at most once every N ms.
|
// Invoke validation from user input (when typing, etc.) at most once every N ms.
|
||||||
const VALIDATION_THROTTLE_MS = 200;
|
const VALIDATION_THROTTLE_MS = 200;
|
||||||
|
@ -29,7 +29,7 @@ function getId() {
|
||||||
return `${BASE_ID}_${count++}`;
|
return `${BASE_ID}_${count++}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IProps extends React.InputHTMLAttributes<HTMLSelectElement | HTMLInputElement> {
|
interface IProps extends React.InputHTMLAttributes<HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement> {
|
||||||
// The field's ID, which binds the input and label together. Immutable.
|
// The field's ID, which binds the input and label together. Immutable.
|
||||||
id?: string,
|
id?: string,
|
||||||
// The element to create. Defaults to "input".
|
// The element to create. Defaults to "input".
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class NotificationsEnabledController extends SettingController {
|
||||||
if (!getNotifier().isPossible()) return false;
|
if (!getNotifier().isPossible()) return false;
|
||||||
|
|
||||||
if (calculatedValue === null || calculatedAtLevel === "default") {
|
if (calculatedValue === null || calculatedAtLevel === "default") {
|
||||||
return isMasterRuleEnabled();
|
return !isMasterRuleEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
return calculatedValue;
|
return calculatedValue;
|
||||||
|
@ -63,7 +63,7 @@ export class NotificationBodyEnabledController extends SettingController {
|
||||||
if (!getNotifier().isPossible()) return false;
|
if (!getNotifier().isPossible()) return false;
|
||||||
|
|
||||||
if (calculatedValue === null) {
|
if (calculatedValue === null) {
|
||||||
return isMasterRuleEnabled();
|
return !isMasterRuleEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
return calculatedValue;
|
return calculatedValue;
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default class LocalEchoWrapper extends SettingsHandler {
|
||||||
const cacheRoomId = roomId ? roomId : "UNDEFINED"; // avoid weird keys
|
const cacheRoomId = roomId ? roomId : "UNDEFINED"; // avoid weird keys
|
||||||
const bySetting = this._cache[settingName];
|
const bySetting = this._cache[settingName];
|
||||||
if (bySetting && bySetting.hasOwnProperty(cacheRoomId)) {
|
if (bySetting && bySetting.hasOwnProperty(cacheRoomId)) {
|
||||||
return bySetting[roomId];
|
return bySetting[cacheRoomId];
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._handler.getValue(settingName, roomId);
|
return this._handler.getValue(settingName, roomId);
|
||||||
|
|
Loading…
Reference in New Issue