Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Weblate 2017-11-15 10:56:13 +00:00
commit 7ab693d776
5 changed files with 46 additions and 27 deletions

View File

@ -21,7 +21,7 @@ import sdk from 'matrix-react-sdk';
import dis from 'matrix-react-sdk/lib/dispatcher'; import dis from 'matrix-react-sdk/lib/dispatcher';
import Velocity from 'velocity-vector'; import Velocity from 'velocity-vector';
import 'velocity-vector/velocity.ui'; import 'velocity-vector/velocity.ui';
import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore'; import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
const CALLOUT_ANIM_DURATION = 1000; const CALLOUT_ANIM_DURATION = 1000;

View File

@ -24,7 +24,7 @@ const sdk = require('matrix-react-sdk');
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
const Modal = require('matrix-react-sdk/lib/Modal'); const Modal = require('matrix-react-sdk/lib/Modal');
const Resend = require("matrix-react-sdk/lib/Resend"); const Resend = require("matrix-react-sdk/lib/Resend");
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore'; import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'MessageContextMenu', displayName: 'MessageContextMenu',
@ -67,7 +67,7 @@ module.exports = React.createClass({
let canPin = room.currentState.mayClientSendStateEvent('m.room.pinned_events', cli); let canPin = room.currentState.mayClientSendStateEvent('m.room.pinned_events', cli);
// HACK: Intentionally say we can't pin if the user doesn't want to use the functionality // HACK: Intentionally say we can't pin if the user doesn't want to use the functionality
if (!UserSettingsStore.isFeatureEnabled("feature_pinning")) canPin = false; if (!SettingsStore.isFeatureEnabled("feature_pinning")) canPin = false;
this.setState({canRedact, canPin}); this.setState({canRedact, canPin});
}, },

View File

@ -18,7 +18,7 @@ limitations under the License.
var React = require('react'); var React = require('react');
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore'; import SettingsStore from 'matrix-react-sdk/lib/settings/SettingsStore';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'VectorLoginFooter', displayName: 'VectorLoginFooter',
@ -28,7 +28,7 @@ module.exports = React.createClass({
render: function() { render: function() {
// FIXME: replace this with a proper Status skin // FIXME: replace this with a proper Status skin
if (UserSettingsStore.getTheme() === 'status') return <div/>; if (SettingsStore.getValue("theme") === 'status') return <div/>;
return ( return (
<div className="mx_Login_links"> <div className="mx_Login_links">

View File

@ -20,11 +20,12 @@ import sdk from 'matrix-react-sdk';
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore'; import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
import SettingsStore, {SettingLevel} from "matrix-react-sdk/lib/settings/SettingsStore";
import Modal from 'matrix-react-sdk/lib/Modal'; import Modal from 'matrix-react-sdk/lib/Modal';
import { import {
NotificationUtils, NotificationUtils,
VectorPushRulesDefinitions, VectorPushRulesDefinitions,
PushRuleVectorState, PushRuleVectorState,
ContentRules ContentRules
} from '../../../notifications'; } from '../../../notifications';
@ -112,12 +113,33 @@ module.exports = React.createClass({
}, },
onEnableDesktopNotificationsChange: function(event) { onEnableDesktopNotificationsChange: function(event) {
UserSettingsStore.setEnableNotifications(event.target.checked); SettingsStore.setValue(
"notificationsEnabled", null,
SettingLevel.DEVICE,
event.target.checked,
).finally(() => {
this.forceUpdate();
});
}, },
onEnableDesktopNotificationBodyChange: function(event) { onEnableDesktopNotificationBodyChange: function(event) {
UserSettingsStore.setEnableNotificationBody(event.target.checked); SettingsStore.setValue(
this.forceUpdate(); "notificationBodyEnabled", null,
SettingLevel.DEVICE,
event.target.checked,
).finally(() => {
this.forceUpdate();
});
},
onEnableAudioNotificationsChange: function(event) {
SettingsStore.setValue(
"audioNotificationsEnabled", null,
SettingLevel.DEVICE,
event.target.checked,
).finally(() => {
this.forceUpdate();
});
}, },
onEnableEmailNotificationsChange: function(address, event) { onEnableEmailNotificationsChange: function(address, event) {
@ -433,7 +455,7 @@ module.exports = React.createClass({
needsUpdate.push( function(kind, rule) { needsUpdate.push( function(kind, rule) {
return cli.setPushRuleActions( return cli.setPushRuleActions(
'global', kind, LEGACY_RULES[rule.rule_id], portLegacyActions(rule.actions) 'global', kind, LEGACY_RULES[rule.rule_id], portLegacyActions(rule.actions)
).then(() => ).then(() =>
cli.deletePushRule('global', kind, rule.rule_id) cli.deletePushRule('global', kind, rule.rule_id)
).catch( (e) => { ).catch( (e) => {
console.warn(`Error when porting legacy rule: ${e}`); console.warn(`Error when porting legacy rule: ${e}`);
@ -446,7 +468,7 @@ module.exports = React.createClass({
if (needsUpdate.length > 0) { if (needsUpdate.length > 0) {
// If some of the rules need to be ported then wait for the porting // If some of the rules need to be ported then wait for the porting
// to happen and then fetch the rules again. // to happen and then fetch the rules again.
return Promise.all(needsUpdate).then(() => return Promise.all(needsUpdate).then(() =>
cli.getPushRules() cli.getPushRules()
); );
} else { } else {
@ -694,13 +716,13 @@ module.exports = React.createClass({
render: function() { render: function() {
const self = this; const self = this;
let spinner; let spinner;
if (this.state.phase === this.phases.LOADING) { if (this.state.phase === this.phases.LOADING) {
const Loader = sdk.getComponent("elements.Spinner"); const Loader = sdk.getComponent("elements.Spinner");
spinner = <Loader />; spinner = <Loader />;
} }
let masterPushRuleDiv; let masterPushRuleDiv;
if (this.state.masterPushRule) { if (this.state.masterPushRule) {
masterPushRuleDiv = ( masterPushRuleDiv = (
@ -710,7 +732,7 @@ module.exports = React.createClass({
ref="enableNotifications" ref="enableNotifications"
type="checkbox" type="checkbox"
checked={ !this.state.masterPushRule.enabled } checked={ !this.state.masterPushRule.enabled }
onChange={ this.onEnableNotificationsChange } onChange={ this.onEnableNotificationsChange }
/> />
</div> </div>
<div className="mx_UserNotifSettings_labelCell"> <div className="mx_UserNotifSettings_labelCell">
@ -824,7 +846,7 @@ module.exports = React.createClass({
<input id="enableDesktopNotifications" <input id="enableDesktopNotifications"
ref="enableDesktopNotifications" ref="enableDesktopNotifications"
type="checkbox" type="checkbox"
checked={ UserSettingsStore.getEnableNotifications() } checked={ SettingsStore.getValue("notificationsEnabled") }
onChange={ this.onEnableDesktopNotificationsChange } /> onChange={ this.onEnableDesktopNotificationsChange } />
</div> </div>
<div className="mx_UserNotifSettings_labelCell"> <div className="mx_UserNotifSettings_labelCell">
@ -839,7 +861,7 @@ module.exports = React.createClass({
<input id="enableDesktopNotificationBody" <input id="enableDesktopNotificationBody"
ref="enableDesktopNotificationBody" ref="enableDesktopNotificationBody"
type="checkbox" type="checkbox"
checked={ UserSettingsStore.getEnableNotificationBody() } checked={ SettingsStore.getValue("notificationBodyEnabled") }
onChange={ this.onEnableDesktopNotificationBodyChange } /> onChange={ this.onEnableDesktopNotificationBodyChange } />
</div> </div>
<div className="mx_UserNotifSettings_labelCell"> <div className="mx_UserNotifSettings_labelCell">
@ -854,11 +876,8 @@ module.exports = React.createClass({
<input id="enableDesktopAudioNotifications" <input id="enableDesktopAudioNotifications"
ref="enableDesktopAudioNotifications" ref="enableDesktopAudioNotifications"
type="checkbox" type="checkbox"
checked={ UserSettingsStore.getEnableAudioNotifications() } checked={ SettingsStore.getValue("audioNotificationsEnabled") }
onChange={ (e) => { onChange={ this.onEnableAudioNotificationsChange } />
UserSettingsStore.setEnableAudioNotifications(e.target.checked);
this.forceUpdate();
}} />
</div> </div>
<div className="mx_UserNotifSettings_labelCell"> <div className="mx_UserNotifSettings_labelCell">
<label htmlFor="enableDesktopAudioNotifications"> <label htmlFor="enableDesktopAudioNotifications">

View File

@ -67,7 +67,6 @@ sdk.loadSkin(require('../component-index'));
var VectorConferenceHandler = require('../VectorConferenceHandler'); var VectorConferenceHandler = require('../VectorConferenceHandler');
import Promise from 'bluebird'; import Promise from 'bluebird';
var request = require('browser-request'); var request = require('browser-request');
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
import * as languageHandler from 'matrix-react-sdk/lib/languageHandler'; import * as languageHandler from 'matrix-react-sdk/lib/languageHandler';
// Also import _t directly so we can call it just `_t` as this is what gen-i18n.js expects // Also import _t directly so we can call it just `_t` as this is what gen-i18n.js expects
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
@ -78,6 +77,7 @@ import {parseQs, parseQsFromFragment} from './url_utils';
import Platform from './platform'; import Platform from './platform';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
import Tinter from 'matrix-react-sdk/lib/Tinter'; import Tinter from 'matrix-react-sdk/lib/Tinter';
var lastLocationHashSet = null; var lastLocationHashSet = null;
@ -252,7 +252,7 @@ async function loadApp() {
if (!preventRedirect) { if (!preventRedirect) {
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) { if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
// FIXME: ugly status hardcoding // FIXME: ugly status hardcoding
if (UserSettingsStore.getTheme() === 'status') { if (SettingsStore.getValue("theme") === 'status') {
window.location = "https://status.im/join-riot.html"; window.location = "https://status.im/join-riot.html";
return; return;
} }
@ -265,7 +265,7 @@ async function loadApp() {
} }
else if (/Android/.test(navigator.userAgent)) { else if (/Android/.test(navigator.userAgent)) {
// FIXME: ugly status hardcoding // FIXME: ugly status hardcoding
if (UserSettingsStore.getTheme() === 'status') { if (SettingsStore.getValue("theme") === 'status') {
window.location = "https://status.im/join-riot.html"; window.location = "https://status.im/join-riot.html";
return; return;
} }
@ -369,7 +369,7 @@ async function loadApp() {
} }
async function loadLanguage() { async function loadLanguage() {
const prefLang = UserSettingsStore.getLocalSetting('language'); const prefLang = SettingsStore.getValue("language");
let langs = []; let langs = [];
if (!prefLang) { if (!prefLang) {