From 2b671fcafcb2de8b70bcfc45d6071e89a72e6b96 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 11 Aug 2016 17:45:10 +0100 Subject: [PATCH 01/20] js-sdk & react sdk released --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3863cd1443..7ec00e701c 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", - "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", + "matrix-js-sdk": "0.5.5", + "matrix-react-sdk": "0.6.4", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.2.1", From 014f7ade864ae5b298862c5121ad7ebb59aaf193 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 11 Aug 2016 17:47:16 +0100 Subject: [PATCH 02/20] Prepare changelog for v0.7.4 --- CHANGELOG.md | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94ad460289..e157311e94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,116 @@ +Changes in [0.7.4](https://github.com/vector-im/vector-web/releases/tag/v0.7.4) (2016-08-11) +============================================================================================ +[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.3...v0.7.4) + + * Don't show border on composer when not in RTE mode + [\#1954](https://github.com/vector-im/vector-web/pull/1954) + * Wmwragg/room tag menu + [\#1941](https://github.com/vector-im/vector-web/pull/1941) + * Don't redirect to mobile app if verifying 3pid + [\#1951](https://github.com/vector-im/vector-web/pull/1951) + * Make sure that we clear localstorage before *all* tests + [\#1950](https://github.com/vector-im/vector-web/pull/1950) + * Basic CSS for multi-invite dialog + [\#1942](https://github.com/vector-im/vector-web/pull/1942) + * More tests for the loading process: + [\#1947](https://github.com/vector-im/vector-web/pull/1947) + * Support for refactored login token handling + [\#1946](https://github.com/vector-im/vector-web/pull/1946) + * Various fixes and improvements to emojification. + [\#1935](https://github.com/vector-im/vector-web/pull/1935) + * More app-loading tests + [\#1938](https://github.com/vector-im/vector-web/pull/1938) + * Some tests of the application load process + [\#1936](https://github.com/vector-im/vector-web/pull/1936) + * Add 'enable labs' setting to sample config + [\#1930](https://github.com/vector-im/vector-web/pull/1930) + * Matthew/scalar + [\#1928](https://github.com/vector-im/vector-web/pull/1928) + * Fix unit tests + [\#1929](https://github.com/vector-im/vector-web/pull/1929) + * Wmwragg/mute mention state fix + [\#1926](https://github.com/vector-im/vector-web/pull/1926) + * CSS for deactivate account dialog + [\#1919](https://github.com/vector-im/vector-web/pull/1919) + * Wmwragg/mention state menu + [\#1900](https://github.com/vector-im/vector-web/pull/1900) + * Fix UnknownBody styling for #1901 + [\#1913](https://github.com/vector-im/vector-web/pull/1913) + * Exclude olm from the webpack + [\#1914](https://github.com/vector-im/vector-web/pull/1914) + * Wmwragg/button updates + [\#1912](https://github.com/vector-im/vector-web/pull/1912) + * Wmwragg/button updates + [\#1828](https://github.com/vector-im/vector-web/pull/1828) + * CSS for device management UI + [\#1909](https://github.com/vector-im/vector-web/pull/1909) + * Fix a warning from RoomSubList + [\#1908](https://github.com/vector-im/vector-web/pull/1908) + * Fix notifications warning layout + [\#1907](https://github.com/vector-im/vector-web/pull/1907) + * Remove relayoutOnUpdate prop on gemini-scrollbar + [\#1883](https://github.com/vector-im/vector-web/pull/1883) + * Bump dependency versions + [\#1842](https://github.com/vector-im/vector-web/pull/1842) + * Wmwragg/mention state indicator round 2 + [\#1835](https://github.com/vector-im/vector-web/pull/1835) + * Wmwragg/spinner fix + [\#1822](https://github.com/vector-im/vector-web/pull/1822) + * Wmwragg/mention state indicator + [\#1823](https://github.com/vector-im/vector-web/pull/1823) + * Revert "Presentation for inline link" + [\#1809](https://github.com/vector-im/vector-web/pull/1809) + * Wmwragg/modal restyle + [\#1806](https://github.com/vector-im/vector-web/pull/1806) + * Presentation for inline link + [\#1799](https://github.com/vector-im/vector-web/pull/1799) + * CSS for offline user colours + [\#1798](https://github.com/vector-im/vector-web/pull/1798) + * Wmwragg/typography updates + [\#1776](https://github.com/vector-im/vector-web/pull/1776) + * webpack: always use the olm from vector-web + [\#1766](https://github.com/vector-im/vector-web/pull/1766) + * feat: large emoji support + [\#1718](https://github.com/vector-im/vector-web/pull/1718) + * Autocomplete + [\#1717](https://github.com/vector-im/vector-web/pull/1717) + * #1664 Set a maximum height for codeblocks + [\#1670](https://github.com/vector-im/vector-web/pull/1670) + * CSS for device blocking + [\#1688](https://github.com/vector-im/vector-web/pull/1688) + * Fix joining rooms by typing the alias + [\#1685](https://github.com/vector-im/vector-web/pull/1685) + * Add ability to delete an alias from room directory + [\#1680](https://github.com/vector-im/vector-web/pull/1680) + * package.json: add olm as optionalDependency + [\#1678](https://github.com/vector-im/vector-web/pull/1678) + * Another go at enabling olm on vector.im/develop + [\#1675](https://github.com/vector-im/vector-web/pull/1675) + * CSS for unverify button + [\#1661](https://github.com/vector-im/vector-web/pull/1661) + * CSS fix for rooms with crypto enabled + [\#1660](https://github.com/vector-im/vector-web/pull/1660) + * Karma: fix warning by ignoring olm + [\#1652](https://github.com/vector-im/vector-web/pull/1652) + * Update for react-sdk dbkr/fix_peeking branch + [\#1639](https://github.com/vector-im/vector-web/pull/1639) + * Update README.md + [\#1641](https://github.com/vector-im/vector-web/pull/1641) + * Fix karma tests + [\#1643](https://github.com/vector-im/vector-web/pull/1643) + * Rich Text Editor + [\#1553](https://github.com/vector-im/vector-web/pull/1553) + * Fix RoomDirectory to join by alias whenever possible. + [\#1615](https://github.com/vector-im/vector-web/pull/1615) + * Make the config optional + [\#1612](https://github.com/vector-im/vector-web/pull/1612) + * CSS support for device verification + [\#1610](https://github.com/vector-im/vector-web/pull/1610) + * Don't use SdkConfig + [\#1609](https://github.com/vector-im/vector-web/pull/1609) + * serve config.json statically instead of bundling it + [\#1516](https://github.com/vector-im/vector-web/pull/1516) + Changes in [0.7.3](https://github.com/vector-im/vector-web/releases/tag/v0.7.3) (2016-06-03) ============================================================================================ [Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.2...v0.7.3) From 25d8a7999f4e5f44b83250c3294c8e3e4922f278 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 11 Aug 2016 17:47:17 +0100 Subject: [PATCH 03/20] 0.7.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ec00e701c..532fbbc3e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vector-web", - "version": "0.7.3", + "version": "0.7.4", "description": "Vector webapp", "author": "matrix.org", "repository": { From 678393e2bd0c23d5c809861a3147b88fc30c9965 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 12 Aug 2016 09:59:56 +0100 Subject: [PATCH 04/20] Add note about file table overflows --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 540c575071..a940da64d2 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,10 @@ will watch for changes to the files and rebuild automatically. If you add or remove any components from the Vector skin, you will need to rebuild the skin's index by running, `npm run reskindex`. +If any of these steps error with, `file table overflow`, you are probably on a mac +which has a very low limit on max open files. Run `ulimit -Sn 1024` and try again. +You'll need to do this in each new terminal you open before building vector. + Filing issues ============= From 5512fd42205ffeae4e23967009379992a4f20133 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 12 Aug 2016 10:09:53 +0100 Subject: [PATCH 05/20] Bump to matrix-react-sdk 0.6.4-r1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 532fbbc3e0..a9915ebaff 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", "matrix-js-sdk": "0.5.5", - "matrix-react-sdk": "0.6.4", + "matrix-react-sdk": "0.6.4-r1", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.2.1", From 3650c3f08bb522e385e61adacf23de6ce2c4aeb6 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 12 Aug 2016 10:11:39 +0100 Subject: [PATCH 06/20] Prepare changelog for v0.7.4-r1 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e157311e94..2103aad1e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [0.7.4-r1](https://github.com/vector-im/vector-web/releases/tag/v0.7.4-r1) (2016-08-12) +================================================================================================== +[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.4...v0.7.4-r1) + * Update to matrix-react-sdk 0.6.4-r1 to fix inviting multiple people + + Changes in [0.7.4](https://github.com/vector-im/vector-web/releases/tag/v0.7.4) (2016-08-11) ============================================================================================ [Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.3...v0.7.4) From 9d77fab18f8ad6d6c50c0a32d050f17e297109a6 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 12 Aug 2016 10:11:40 +0100 Subject: [PATCH 07/20] 0.7.4-r1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9915ebaff..84f3362f3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vector-web", - "version": "0.7.4", + "version": "0.7.4-r1", "description": "Vector webapp", "author": "matrix.org", "repository": { From 3a819a29b7c0b3e1e9348e5a9baa0c766fb15f07 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 12 Aug 2016 11:01:01 +0100 Subject: [PATCH 08/20] Make up a device display name Pass a default device name into react-sdk --- package.json | 4 +++- src/vector/index.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3863cd1443..d95348eed9 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,9 @@ "react-dnd-html5-backend": "^2.1.2", "react-dom": "^15.2.1", "react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef", - "sanitize-html": "^1.11.1" + "sanitize-html": "^1.11.1", + "ua-parser-js": "^0.7.10", + "url": "^0.11.0" }, "devDependencies": { "babel": "^5.8.23", diff --git a/src/vector/index.js b/src/vector/index.js index 0750109404..6264f744d0 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -44,6 +44,8 @@ var VectorConferenceHandler = require('../VectorConferenceHandler'); var UpdateChecker = require("./updater"); var q = require('q'); var request = require('browser-request'); + +import UAParser from 'ua-parser-js'; import url from 'url'; import {parseQs, parseQsFromFragment} from './url_utils'; @@ -134,6 +136,19 @@ var makeRegistrationUrl = function() { '#/register'; } + +function getDefaultDeviceName() { + // strip query-string and fragment from uri + let u = url.parse(window.location.href); + u.search = ""; + u.hash = ""; + let app_name = u.format(); + + let ua = new UAParser(); + return app_name + " via " + ua.getBrowser().name + + " on " + ua.getOS().name; +} + window.addEventListener('hashchange', onHashChange); window.onload = function() { console.log("window.onload"); @@ -238,6 +253,7 @@ async function loadApp() { startingFragmentQueryParams={fragparts.params} enableGuest={true} onLoadCompleted={onLoadCompleted} + default_device_name={getDefaultDeviceName()} />, document.getElementById('matrixchat') ); From 17733a66f9b199b351ba87951c2d9116667ab7ab Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 12 Aug 2016 11:40:25 +0100 Subject: [PATCH 09/20] rename MatrixChat defaultDeviceDisplayName prop --- src/vector/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vector/index.js b/src/vector/index.js index 6264f744d0..fff61bed49 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -137,7 +137,7 @@ var makeRegistrationUrl = function() { } -function getDefaultDeviceName() { +function getDefaultDeviceDisplayName() { // strip query-string and fragment from uri let u = url.parse(window.location.href); u.search = ""; @@ -253,7 +253,7 @@ async function loadApp() { startingFragmentQueryParams={fragparts.params} enableGuest={true} onLoadCompleted={onLoadCompleted} - default_device_name={getDefaultDeviceName()} + defaultDeviceDisplayName={getDefaultDeviceDisplayName()} />, document.getElementById('matrixchat') ); From a17df609f32b44834cbd0e4bccc3a977182bf013 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 12 Aug 2016 15:19:34 +0100 Subject: [PATCH 10/20] Read all 4 different notif states Can't yet set loud / mute --- .../NotificationStateContextMenu.js | 28 ++------ src/notifications/RoomNotifs.js | 70 +++++++++++++++++++ 2 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 src/notifications/RoomNotifs.js diff --git a/src/components/views/context_menus/NotificationStateContextMenu.js b/src/components/views/context_menus/NotificationStateContextMenu.js index 8430f8efc4..21b17fe668 100644 --- a/src/components/views/context_menus/NotificationStateContextMenu.js +++ b/src/components/views/context_menus/NotificationStateContextMenu.js @@ -21,6 +21,7 @@ var React = require('react'); var classNames = require('classnames'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var dis = require('matrix-react-sdk/lib/dispatcher'); +var RoomNotifs = require('../../../notifications/RoomNotifs'); module.exports = React.createClass({ displayName: 'NotificationStateContextMenu', @@ -31,23 +32,6 @@ module.exports = React.createClass({ onFinished: React.PropTypes.func, }, - getInitialState: function() { - var areNotifsMuted = false; - var cli = MatrixClientPeg.get(); - if (!cli.isGuest()) { - var roomPushRule = cli.getRoomPushRule("global", this.props.room.roomId); - if (roomPushRule) { - if (0 <= roomPushRule.actions.indexOf("dont_notify")) { - areNotifsMuted = true; - } - } - } - - return { - areNotifsMuted: areNotifsMuted, - }; - }, - _save: function( areNotifsMuted ) { var self = this; const roomId = this.props.room.roomId; @@ -100,26 +84,26 @@ module.exports = React.createClass({ }, render: function() { - var cli = MatrixClientPeg.get(); + const vectorRoomNotifState = RoomNotifs.getVectorRoomNotifsState(this.props.room.roomId); var alertMeClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldDisabled': true, + 'mx_NotificationStateContextMenu_fieldSet': vectorRoomNotifState == 'all_messages_loud', }); var allNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': !this.state.areNotifsMuted, + 'mx_NotificationStateContextMenu_fieldSet': vectorRoomNotifState == 'all_messages', }); var mentionsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.areNotifsMuted, + 'mx_NotificationStateContextMenu_fieldSet': vectorRoomNotifState == 'mentions_only', }); var muteNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldDisabled': true, + 'mx_NotificationStateContextMenu_fieldDisabled': vectorRoomNotifState == 'mute', }); return ( diff --git a/src/notifications/RoomNotifs.js b/src/notifications/RoomNotifs.js new file mode 100644 index 0000000000..35b1f1252e --- /dev/null +++ b/src/notifications/RoomNotifs.js @@ -0,0 +1,70 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; +import PushProcessor from 'matrix-js-sdk/lib/pushprocessor'; + +export function getVectorRoomNotifsState(roomId) { + // look through the override rules for a rule affecting this room: + // if one exists, it will take precedence. + for (const rule of MatrixClientPeg.get().pushRules['global'].override) { + if (isRuleForRoom(roomId, rule)) { + if (isMuteRule(rule)) { + return 'mute'; + } + } + } + + // for everything else, look at the room rule. + const roomRule = MatrixClientPeg.get().getRoomPushRule('global', roomId); + + // XXX: We have to assume the default is to notify for all messages + // (in particular this will be 'wrong' for one to one rooms because + // they will notify loudly for all messages) + if (!roomRule) return 'all_messages'; + + // a mute at the room level will still allow mentions + // to notify + if (isMuteRule(roomRule)) return 'mentions_only'; + + const actionsObject = PushProcessor.actionListToActionsObject(roomRule.actions); + if (actionsObject.tweaks.sound) return 'all_messages_loud'; + + return null; +} + +function isRuleForRoom(roomId, rule) { + if (rule.conditions.length !== 1) { + return false; + } + const cond = rule.conditions[0]; + if ( + cond.kind == 'event_match' && + cond.key == 'room_id' && + cond.pattern == roomId + ) { + return true; + } + return false; +} + +function isMuteRule(rule) { + return ( + rule.actions.length == 1 && + rule.actions[0] == 'dont_notify' + ); +} + From 21334cab2825bb6306507d4341a3df4a7a81d4f9 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 15 Aug 2016 12:11:35 +0100 Subject: [PATCH 11/20] Unpin react-sdk and js-sdk --- package.json | 4 ++-- scripts/staticfiles.js | 21 --------------------- 2 files changed, 2 insertions(+), 23 deletions(-) delete mode 100755 scripts/staticfiles.js diff --git a/package.json b/package.json index 56dc7ee26f..64c1d38aaa 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "0.5.5", - "matrix-react-sdk": "0.6.4-r1", + "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", + "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.2.1", diff --git a/scripts/staticfiles.js b/scripts/staticfiles.js deleted file mode 100755 index 3dbf451cd3..0000000000 --- a/scripts/staticfiles.js +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node - -// copy static files from node_modules to the vector directory -// - -var fs = require('fs-extra'); - -function exists(f) { - try { - fs.statSync(f); - return true; - } catch(e) { - return false; - } -} - -const olm = 'node_modules/olm/olm.js'; -if (exists(olm)) { - console.log("copy", olm, "-> vector"); - fs.copySync(olm, 'vector/olm.js'); -} From 8a2b2daad77b7b34990794ac074c65f27f7de4d4 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 15 Aug 2016 12:13:58 +0100 Subject: [PATCH 12/20] Revert "Unpin react-sdk and js-sdk" I messed this up and removed staticfiles.js by accident This reverts commit 21334cab2825bb6306507d4341a3df4a7a81d4f9. --- package.json | 4 ++-- scripts/staticfiles.js | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 scripts/staticfiles.js diff --git a/package.json b/package.json index 64c1d38aaa..56dc7ee26f 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", - "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", + "matrix-js-sdk": "0.5.5", + "matrix-react-sdk": "0.6.4-r1", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.2.1", diff --git a/scripts/staticfiles.js b/scripts/staticfiles.js new file mode 100755 index 0000000000..3dbf451cd3 --- /dev/null +++ b/scripts/staticfiles.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node + +// copy static files from node_modules to the vector directory +// + +var fs = require('fs-extra'); + +function exists(f) { + try { + fs.statSync(f); + return true; + } catch(e) { + return false; + } +} + +const olm = 'node_modules/olm/olm.js'; +if (exists(olm)) { + console.log("copy", olm, "-> vector"); + fs.copySync(olm, 'vector/olm.js'); +} From 1d435890afb3f1f30f9ef67735c1d93d0fa2f47b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 15 Aug 2016 12:15:24 +0100 Subject: [PATCH 13/20] Unpin react-sdk and js-sdk --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 56dc7ee26f..64c1d38aaa 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "0.5.5", - "matrix-react-sdk": "0.6.4-r1", + "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", + "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.2.1", From 4c9ade5ecb9b5e5c97b33e226f5656f636889432 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 15 Aug 2016 12:16:08 +0100 Subject: [PATCH 14/20] Use cpx to copy olm.js, and add watcher We are now using `cpx` to copy the emojione files, so we might as well use it for olm.js, rather than rolling our own - particularly since that makes it easy to add a watcher for `npm start`. We have to add a `-L` to the `cpx` invocation, otherwise, if olm is a symlink (as is useful for development), cpx ends up watching the symlink, which obviously never changes. --- package.json | 7 ++++--- scripts/staticfiles.js | 21 --------------------- 2 files changed, 4 insertions(+), 24 deletions(-) delete mode 100755 scripts/staticfiles.js diff --git a/package.json b/package.json index 64c1d38aaa..be87139b26 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "build:compile": "babel --source-maps -d lib src", "build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js", "build:bundle:dev": "NODE_ENV=production webpack --optimize-occurence-order lib/vector/index.js vector/bundle.js", - "build:staticfiles": "scripts/staticfiles.js", + "build:staticfiles": "cpx -v node_modules/olm/olm.js vector/", "build": "npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle", "build:dev": "npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle:dev", "package": "scripts/package.sh", @@ -26,9 +26,10 @@ "start:js": "webpack -w src/vector/index.js vector/bundle.js", "start:js:prod": "NODE_ENV=production webpack -w src/vector/index.js vector/bundle.js", "start:skins:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css", + "start:staticfiles": "cpx -Lwv node_modules/olm/olm.js vector/", "//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270", - "start": "parallelshell \"npm run build:staticfiles\" \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", - "start:prod": "parallelshell \"npm run build:staticfiles\" \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", + "start": "parallelshell \"npm run start:staticfiles\" \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", + "start:prod": "parallelshell \"npm run start:staticfiles\" \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", "clean": "rimraf lib vector/olm.js vector/bundle.css vector/bundle.js vector/bundle.js.map vector/webpack.css* vector/emojione", "prepublish": "npm run build:css && npm run build:compile", "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", diff --git a/scripts/staticfiles.js b/scripts/staticfiles.js deleted file mode 100755 index 3dbf451cd3..0000000000 --- a/scripts/staticfiles.js +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node - -// copy static files from node_modules to the vector directory -// - -var fs = require('fs-extra'); - -function exists(f) { - try { - fs.statSync(f); - return true; - } catch(e) { - return false; - } -} - -const olm = 'node_modules/olm/olm.js'; -if (exists(olm)) { - console.log("copy", olm, "-> vector"); - fs.copySync(olm, 'vector/olm.js'); -} From d3eccc1d6f7f3e19a39df41f9658d056a7feff04 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 15 Aug 2016 21:37:37 +0100 Subject: [PATCH 15/20] add rel='noopener' wherever we do target='_blank' because https://mathiasbynens.github.io/rel-noopener/ --- src/components/views/elements/ImageView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/ImageView.js b/src/components/views/elements/ImageView.js index 38ca2e5827..c47fecfed6 100644 --- a/src/components/views/elements/ImageView.js +++ b/src/components/views/elements/ImageView.js @@ -80,7 +80,7 @@ module.exports = React.createClass({ getName: function () { var name = this.props.name; if (name && this.props.link) { - name = { name }; + name = { name }; } return name; }, @@ -169,7 +169,7 @@ module.exports = React.createClass({ { this.getName() } { eventMeta } - +
Download this file
{ size_res } From cd0ed879e36e82bb7b391527747e760fbd0d3b4f Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 16 Aug 2016 15:54:28 +0100 Subject: [PATCH 16/20] Make the slider work Still WIP though: need to make vector work with the 'contains display name' rule being an override --- .../NotificationStateContextMenu.js | 52 +++++++----- src/notifications/RoomNotifs.js | 81 +++++++++++++++++-- .../VectorPushRulesDefinitions.js | 2 +- 3 files changed, 105 insertions(+), 30 deletions(-) diff --git a/src/components/views/context_menus/NotificationStateContextMenu.js b/src/components/views/context_menus/NotificationStateContextMenu.js index 21b17fe668..f263f44ac2 100644 --- a/src/components/views/context_menus/NotificationStateContextMenu.js +++ b/src/components/views/context_menus/NotificationStateContextMenu.js @@ -32,78 +32,86 @@ module.exports = React.createClass({ onFinished: React.PropTypes.func, }, - _save: function( areNotifsMuted ) { - var self = this; + getInitialState() { + return { + vectorRoomNotifState: RoomNotifs.getVectorRoomNotifsState(this.props.room.roomId), + } + }, + + _save: function(newState) { + const oldState = this.state.vectorRoomNotifState; const roomId = this.props.room.roomId; var cli = MatrixClientPeg.get(); if (!cli.isGuest()) { // Wrapping this in a q promise, as setRoomMutePushRule can return // a promise or a value - q(cli.setRoomMutePushRule("global", roomId, areNotifsMuted)) - .then(function() { - self.setState({areNotifsMuted: areNotifsMuted}); - + this.setState({ + vectorRoomNotifState: newState, + }); + RoomNotifs.setVectorRoomNotifsState(this.props.room.roomId, newState).done(() => { // delay slightly so that the user can see their state change // before closing the menu - return q.delay(500).then(function() { + return q.delay(500).then(() => { // tell everyone that wants to know of the change in // notification state dis.dispatch({ action: 'notification_change', - roomId: self.props.room.roomId, - areNotifsMuted: areNotifsMuted, + roomId: this.props.room.roomId, + //areNotifsMuted: areNotifsMuted, }); // Close the context menu - if (self.props.onFinished) { - self.props.onFinished(); + if (this.props.onFinished) { + this.props.onFinished(); }; }); - }).fail(function(error) { + }, (error) => { // TODO: some form of error notification to the user // to inform them that their state change failed. + // For now we at least set the state back + this.setState({ + vectorRoomNotifState: oldState, + }); }); } }, _onClickAlertMe: function() { - // Placeholder + this._save('all_messages_loud'); }, _onClickAllNotifs: function() { - this._save(false); + this._save('all_messages'); }, _onClickMentions: function() { - this._save(true); + this._save('mentions_only'); }, _onClickMute: function() { - // Placeholder + this._save('mute'); }, render: function() { - const vectorRoomNotifState = RoomNotifs.getVectorRoomNotifsState(this.props.room.roomId); - var alertMeClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': vectorRoomNotifState == 'all_messages_loud', + 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'all_messages_loud', }); var allNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': vectorRoomNotifState == 'all_messages', + 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'all_messages', }); var mentionsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': vectorRoomNotifState == 'mentions_only', + 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'mentions_only', }); var muteNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldDisabled': vectorRoomNotifState == 'mute', + 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'mute', }); return ( diff --git a/src/notifications/RoomNotifs.js b/src/notifications/RoomNotifs.js index 35b1f1252e..e07b3ac8c7 100644 --- a/src/notifications/RoomNotifs.js +++ b/src/notifications/RoomNotifs.js @@ -16,16 +16,14 @@ limitations under the License. import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import PushProcessor from 'matrix-js-sdk/lib/pushprocessor'; +import q from 'q'; export function getVectorRoomNotifsState(roomId) { // look through the override rules for a rule affecting this room: // if one exists, it will take precedence. - for (const rule of MatrixClientPeg.get().pushRules['global'].override) { - if (isRuleForRoom(roomId, rule)) { - if (isMuteRule(rule)) { - return 'mute'; - } - } + const muteRule = findOverrideMuteRule(roomId); + if (muteRule && muteRule.enabled) { + return 'mute'; } // for everything else, look at the room rule. @@ -34,7 +32,7 @@ export function getVectorRoomNotifsState(roomId) { // XXX: We have to assume the default is to notify for all messages // (in particular this will be 'wrong' for one to one rooms because // they will notify loudly for all messages) - if (!roomRule) return 'all_messages'; + if (!roomRule || !roomRule.enabled) return 'all_messages'; // a mute at the room level will still allow mentions // to notify @@ -46,6 +44,75 @@ export function getVectorRoomNotifsState(roomId) { return null; } +export function setVectorRoomNotifsState(roomId, newState) { + const cli = MatrixClientPeg.get(); + const promises = []; + + if (newState == 'mute') { + // delete the room rule + const roomRule = MatrixClientPeg.get().getRoomPushRule('global', roomId); + if (roomRule) { + promises.push(cli.deletePushRule('global', 'room', roomRule.rule_id)); + } + + // add an override rule to squelch everything in this room + promises.push(cli.addPushRule('global', 'override', roomId, { + conditions: [ + { + kind: 'event_match', + key: 'room_id', + pattern: roomId, + } + ], + actions: [ + 'dont_notify', + ] + })); + } else { + const overrideMuteRule = findOverrideMuteRule(roomId); + if (overrideMuteRule) { + promises.push(cli.deletePushRule('global', 'override', overrideMuteRule.rule_id)); + } + + if (newState == 'all_messages') { + promises.push(cli.deletePushRule('global', 'room', roomId)); + } else if (newState == 'mentions_only') { + promises.push(cli.addPushRule('global', 'room', roomId, { + actions: [ + 'dont_notify', + ] + })); + // https://matrix.org/jira/browse/SPEC-400 + promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true)); + } else if ('all_messages_loud') { + promises.push(cli.addPushRule('global', 'room', roomId, { + actions: [ + 'notify', + { + set_tweak: 'sound', + value: 'default', + } + ] + })); + // https://matrix.org/jira/browse/SPEC-400 + promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true)); + } + } + + return q.all(promises); +} + +function findOverrideMuteRule(roomId) { + for (const rule of MatrixClientPeg.get().pushRules['global'].override) { + if (isRuleForRoom(roomId, rule)) { + if (isMuteRule(rule)) { + return rule; + } + } + } + return null; +} + function isRuleForRoom(roomId, rule) { if (rule.conditions.length !== 1) { return false; diff --git a/src/notifications/VectorPushRulesDefinitions.js b/src/notifications/VectorPushRulesDefinitions.js index dfbc06c083..2e90e576ba 100644 --- a/src/notifications/VectorPushRulesDefinitions.js +++ b/src/notifications/VectorPushRulesDefinitions.js @@ -65,7 +65,7 @@ module.exports = { // Messages containing user's display name // (skip contains_user_name which is too geeky) ".m.rule.contains_display_name": new VectorPushRuleDefinition({ - kind: "underride", + kind: "override", description: "Messages containing my name", vectorStateToActions: { // The actions for each vector state, or null to disable the rule. on: StandardActions.ACTION_NOTIFY, From 6b0aeefc66b4defa3269b0e8179f9fde8d3cc94d Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 17 Aug 2016 18:29:38 +0100 Subject: [PATCH 17/20] RoomNotifs.js moved to react-sdk Since it's now used in RoomTile. Remove the vector prefix since it's no longer really a 'vector' thing --- .../NotificationStateContextMenu.js | 29 ++-- src/notifications/RoomNotifs.js | 137 ------------------ 2 files changed, 10 insertions(+), 156 deletions(-) delete mode 100644 src/notifications/RoomNotifs.js diff --git a/src/components/views/context_menus/NotificationStateContextMenu.js b/src/components/views/context_menus/NotificationStateContextMenu.js index f263f44ac2..3e6cb1fafd 100644 --- a/src/components/views/context_menus/NotificationStateContextMenu.js +++ b/src/components/views/context_menus/NotificationStateContextMenu.js @@ -19,9 +19,8 @@ limitations under the License. var q = require("q"); var React = require('react'); var classNames = require('classnames'); +var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); -var dis = require('matrix-react-sdk/lib/dispatcher'); -var RoomNotifs = require('../../../notifications/RoomNotifs'); module.exports = React.createClass({ displayName: 'NotificationStateContextMenu', @@ -34,12 +33,12 @@ module.exports = React.createClass({ getInitialState() { return { - vectorRoomNotifState: RoomNotifs.getVectorRoomNotifsState(this.props.room.roomId), + roomNotifState: RoomNotifs.getRoomNotifsState(this.props.room.roomId), } }, _save: function(newState) { - const oldState = this.state.vectorRoomNotifState; + const oldState = this.state.roomNotifState; const roomId = this.props.room.roomId; var cli = MatrixClientPeg.get(); @@ -47,20 +46,12 @@ module.exports = React.createClass({ // Wrapping this in a q promise, as setRoomMutePushRule can return // a promise or a value this.setState({ - vectorRoomNotifState: newState, + roomNotifState: newState, }); - RoomNotifs.setVectorRoomNotifsState(this.props.room.roomId, newState).done(() => { + RoomNotifs.setRoomNotifsState(this.props.room.roomId, newState).done(() => { // delay slightly so that the user can see their state change // before closing the menu return q.delay(500).then(() => { - // tell everyone that wants to know of the change in - // notification state - dis.dispatch({ - action: 'notification_change', - roomId: this.props.room.roomId, - //areNotifsMuted: areNotifsMuted, - }); - // Close the context menu if (this.props.onFinished) { this.props.onFinished(); @@ -71,7 +62,7 @@ module.exports = React.createClass({ // to inform them that their state change failed. // For now we at least set the state back this.setState({ - vectorRoomNotifState: oldState, + roomNotifState: oldState, }); }); } @@ -96,22 +87,22 @@ module.exports = React.createClass({ render: function() { var alertMeClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'all_messages_loud', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'all_messages_loud', }); var allNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'all_messages', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'all_messages', }); var mentionsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'mentions_only', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'mentions_only', }); var muteNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'mute', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'mute', }); return ( diff --git a/src/notifications/RoomNotifs.js b/src/notifications/RoomNotifs.js deleted file mode 100644 index e07b3ac8c7..0000000000 --- a/src/notifications/RoomNotifs.js +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright 2016 OpenMarket Ltd - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; -import PushProcessor from 'matrix-js-sdk/lib/pushprocessor'; -import q from 'q'; - -export function getVectorRoomNotifsState(roomId) { - // look through the override rules for a rule affecting this room: - // if one exists, it will take precedence. - const muteRule = findOverrideMuteRule(roomId); - if (muteRule && muteRule.enabled) { - return 'mute'; - } - - // for everything else, look at the room rule. - const roomRule = MatrixClientPeg.get().getRoomPushRule('global', roomId); - - // XXX: We have to assume the default is to notify for all messages - // (in particular this will be 'wrong' for one to one rooms because - // they will notify loudly for all messages) - if (!roomRule || !roomRule.enabled) return 'all_messages'; - - // a mute at the room level will still allow mentions - // to notify - if (isMuteRule(roomRule)) return 'mentions_only'; - - const actionsObject = PushProcessor.actionListToActionsObject(roomRule.actions); - if (actionsObject.tweaks.sound) return 'all_messages_loud'; - - return null; -} - -export function setVectorRoomNotifsState(roomId, newState) { - const cli = MatrixClientPeg.get(); - const promises = []; - - if (newState == 'mute') { - // delete the room rule - const roomRule = MatrixClientPeg.get().getRoomPushRule('global', roomId); - if (roomRule) { - promises.push(cli.deletePushRule('global', 'room', roomRule.rule_id)); - } - - // add an override rule to squelch everything in this room - promises.push(cli.addPushRule('global', 'override', roomId, { - conditions: [ - { - kind: 'event_match', - key: 'room_id', - pattern: roomId, - } - ], - actions: [ - 'dont_notify', - ] - })); - } else { - const overrideMuteRule = findOverrideMuteRule(roomId); - if (overrideMuteRule) { - promises.push(cli.deletePushRule('global', 'override', overrideMuteRule.rule_id)); - } - - if (newState == 'all_messages') { - promises.push(cli.deletePushRule('global', 'room', roomId)); - } else if (newState == 'mentions_only') { - promises.push(cli.addPushRule('global', 'room', roomId, { - actions: [ - 'dont_notify', - ] - })); - // https://matrix.org/jira/browse/SPEC-400 - promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true)); - } else if ('all_messages_loud') { - promises.push(cli.addPushRule('global', 'room', roomId, { - actions: [ - 'notify', - { - set_tweak: 'sound', - value: 'default', - } - ] - })); - // https://matrix.org/jira/browse/SPEC-400 - promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true)); - } - } - - return q.all(promises); -} - -function findOverrideMuteRule(roomId) { - for (const rule of MatrixClientPeg.get().pushRules['global'].override) { - if (isRuleForRoom(roomId, rule)) { - if (isMuteRule(rule)) { - return rule; - } - } - } - return null; -} - -function isRuleForRoom(roomId, rule) { - if (rule.conditions.length !== 1) { - return false; - } - const cond = rule.conditions[0]; - if ( - cond.kind == 'event_match' && - cond.key == 'room_id' && - cond.pattern == roomId - ) { - return true; - } - return false; -} - -function isMuteRule(rule) { - return ( - rule.actions.length == 1 && - rule.actions[0] == 'dont_notify' - ); -} - From e48d68a449e22b137a5f2518ebb06ebd04654ef9 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 18 Aug 2016 13:11:57 +0100 Subject: [PATCH 18/20] PR feedback --- .../NotificationStateContextMenu.js | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/src/components/views/context_menus/NotificationStateContextMenu.js b/src/components/views/context_menus/NotificationStateContextMenu.js index 3e6cb1fafd..e78483adc4 100644 --- a/src/components/views/context_menus/NotificationStateContextMenu.js +++ b/src/components/views/context_menus/NotificationStateContextMenu.js @@ -37,35 +37,43 @@ module.exports = React.createClass({ } }, + componentWillMount: function() { + this._unmounted = false; + }, + + componentWillUnmount: function() { + this._unmounted = true; + }, + _save: function(newState) { const oldState = this.state.roomNotifState; const roomId = this.props.room.roomId; var cli = MatrixClientPeg.get(); - if (!cli.isGuest()) { - // Wrapping this in a q promise, as setRoomMutePushRule can return - // a promise or a value + if (cli.isGuest()) return; + + this.setState({ + roomNotifState: newState, + }); + RoomNotifs.setRoomNotifsState(this.props.room.roomId, newState).done(() => { + // delay slightly so that the user can see their state change + // before closing the menu + return q.delay(500).then(() => { + if (this._unmounted) return; + // Close the context menu + if (this.props.onFinished) { + this.props.onFinished(); + }; + }); + }, (error) => { + // TODO: some form of error notification to the user + // to inform them that their state change failed. + // For now we at least set the state back + if (this._unmounted) return; this.setState({ - roomNotifState: newState, + roomNotifState: oldState, }); - RoomNotifs.setRoomNotifsState(this.props.room.roomId, newState).done(() => { - // delay slightly so that the user can see their state change - // before closing the menu - return q.delay(500).then(() => { - // Close the context menu - if (this.props.onFinished) { - this.props.onFinished(); - }; - }); - }, (error) => { - // TODO: some form of error notification to the user - // to inform them that their state change failed. - // For now we at least set the state back - this.setState({ - roomNotifState: oldState, - }); - }); - } + }); }, _onClickAlertMe: function() { From 0bb3eaaf67b301e917b0fe63be25579bcc6ca2f2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 18 Aug 2016 13:46:47 +0100 Subject: [PATCH 19/20] Use constants --- .../NotificationStateContextMenu.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/views/context_menus/NotificationStateContextMenu.js b/src/components/views/context_menus/NotificationStateContextMenu.js index e78483adc4..243275db27 100644 --- a/src/components/views/context_menus/NotificationStateContextMenu.js +++ b/src/components/views/context_menus/NotificationStateContextMenu.js @@ -77,40 +77,40 @@ module.exports = React.createClass({ }, _onClickAlertMe: function() { - this._save('all_messages_loud'); + this._save(RoomNotifs.ALL_MESSAGES_LOUD); }, _onClickAllNotifs: function() { - this._save('all_messages'); + this._save(RoomNotifs.ALL_MESSAGES); }, _onClickMentions: function() { - this._save('mentions_only'); + this._save(RoomNotifs.MENTIONS_ONLY); }, _onClickMute: function() { - this._save('mute'); + this._save(RoomNotifs.MUTE); }, render: function() { var alertMeClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'all_messages_loud', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == RoomNotifs.ALL_MESSAGES_LOUD, }); var allNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'all_messages', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == RoomNotifs.ALL_MESSAGES, }); var mentionsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'mentions_only', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == RoomNotifs.MENTIONS_ONLY, }); var muteNotifsClasses = classNames({ 'mx_NotificationStateContextMenu_field': true, - 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'mute', + 'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == RoomNotifs.MUTE, }); return ( From 9b5e5c9acba1ee3fd2b1f8ff482f81ac18d46828 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 18 Aug 2016 16:47:52 +0100 Subject: [PATCH 20/20] squidge video icon a bit --- src/skins/vector/img/icons-video.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/skins/vector/img/icons-video.svg b/src/skins/vector/img/icons-video.svg index 3571ec7f21..a35df49bb1 100644 --- a/src/skins/vector/img/icons-video.svg +++ b/src/skins/vector/img/icons-video.svg @@ -8,8 +8,8 @@ - - + +