Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix various issues surrounding granular settings to date #1613

Merged
merged 10 commits into from
Nov 16, 2017

Conversation

turt2live
Copy link
Member

Partner PRs

Fixes

Description

All of the issues reported are edge cases to the granular settings system in one way or another. Each fix is described in the commit body.

This PR additionally includes a missed case where the default theme should be loaded through SettingsStore so that the override procedure is not defined in several places. This is the reason for the riot-web PR.

Signed-off-by: Travis Ralston <travpc@gmail.com>
Otherwise `!null` ends up being "true", therefore forcing URL previews on for everyone.

Fixes element-hq/element-web#5607

Signed-off-by: Travis Ralston <travpc@gmail.com>
This shouldn't currently be causing problems, but will in teh future. The bug can be exposed by having a setting where the level order is completely reversed, therefore causing LEVEL_ORDER[0] to actually be the most generic, not the most specific. Instead, we'll pull in the setting's level order and fallback to LEVEL_ORDER, therefore requesting the most specific value.

Signed-off-by: Travis Ralston <travpc@gmail.com>
Fixes element-hq/element-web#5611

Signed-off-by: Travis Ralston <travpc@gmail.com>
Otherwise we end up lying and saying notifications are disabled, despite the push rules saying otherwise.

Part 1 of the fix for:
* element-hq/element-web#5603
* element-hq/element-web#5606

Signed-off-by: Travis Ralston <travpc@gmail.com>
Previously the push rule was ignored, leading to all kinds of interesting issues regarding notifications. This fixes those issues by giving the master push rule the authority it deserves for reasonable defaults.

Part 2 of the fix for:
* element-hq/element-web#5603
* element-hq/element-web#5606

Signed-off-by: Travis Ralston <travpc@gmail.com>
Signed-off-by: Travis Ralston <travpc@gmail.com>
@@ -613,8 +613,7 @@ module.exports = React.createClass({

onLanguageChange: function(newLang) {
if(this.state.language !== newLang) {
// We intentionally promote this to the account level at this point
SettingsStore.setValue("language", null, SettingLevel.ACCOUNT, newLang);
SettingsStore.setValue("language", null, SettingLevel.DEVICE, newLang);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the inevitable question: I have no idea why this got promoted to an account level setting. It's always been a local setting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah, i love the idea of changing language on one device magically synchronising over all your accounts :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'love' in a "aaaaaargh no" kinda way

@@ -891,7 +891,7 @@ module.exports = React.createClass({
*/
_onSetTheme: function(theme) {
if (!theme) {
theme = this.props.config.default_theme || 'light';
theme = SettingsStore.getValueAt(SettingLevel.DEFAULT, "theme");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/ :D

return false;
}

// Why enabled == false means "enabled" is beyond me.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the masterRule acts to disable push, apparently.

if (!Notifier.isPossible()) return false;

if (calculatedValue === null) {
console.log(isMasterRuleEnabled());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, i assume this is rogue debug

@ara4n ara4n merged commit 30b8d0e into matrix-org:develop Nov 16, 2017
@ara4n
Copy link
Member

ara4n commented Nov 16, 2017

lgtm!

@@ -40,7 +40,6 @@ export class NotificationsEnabledController extends SettingController {
if (!Notifier.isPossible()) return false;

if (calculatedValue === null) {
console.log(isMasterRuleEnabled());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops ._.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants