From 93d81d27ba408dec8bb0a992be1df6db91e41d46 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Oct 2015 12:32:40 +0100 Subject: [PATCH 01/20] fix memberDict reference --- src/skins/vector/views/organisms/MemberList.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/skins/vector/views/organisms/MemberList.js b/src/skins/vector/views/organisms/MemberList.js index 1cf0bf27..1fd8c4d2 100644 --- a/src/skins/vector/views/organisms/MemberList.js +++ b/src/skins/vector/views/organisms/MemberList.js @@ -35,9 +35,13 @@ module.exports = React.createClass({ makeMemberTiles: function() { var MemberTile = sdk.getComponent("molecules.MemberTile"); + if (!self.memberDict) { + return null; + } + var self = this; - return Object.keys(self.state.memberDict).map(function(userId) { - var m = self.state.memberDict[userId]; + return Object.keys(self.memberDict).map(function(userId) { + var m = self.memberDict[userId]; return ( ); From 209889210b86bcd6b610657f13fe17c5e8db7251 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Oct 2015 12:36:10 +0100 Subject: [PATCH 02/20] Remove unnececessary and wrong null check --- src/skins/vector/views/organisms/MemberList.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/skins/vector/views/organisms/MemberList.js b/src/skins/vector/views/organisms/MemberList.js index 1fd8c4d2..f45d215d 100644 --- a/src/skins/vector/views/organisms/MemberList.js +++ b/src/skins/vector/views/organisms/MemberList.js @@ -35,10 +35,6 @@ module.exports = React.createClass({ makeMemberTiles: function() { var MemberTile = sdk.getComponent("molecules.MemberTile"); - if (!self.memberDict) { - return null; - } - var self = this; return Object.keys(self.memberDict).map(function(userId) { var m = self.memberDict[userId]; From 044c75270fe51e6fdb37521d5e4bbd68f04deb98 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Oct 2015 12:41:16 +0100 Subject: [PATCH 03/20] This has changed in newer react sdk but in master, it should be state.memberDict --- src/skins/vector/views/organisms/MemberList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/skins/vector/views/organisms/MemberList.js b/src/skins/vector/views/organisms/MemberList.js index f45d215d..1cf0bf27 100644 --- a/src/skins/vector/views/organisms/MemberList.js +++ b/src/skins/vector/views/organisms/MemberList.js @@ -36,8 +36,8 @@ module.exports = React.createClass({ var MemberTile = sdk.getComponent("molecules.MemberTile"); var self = this; - return Object.keys(self.memberDict).map(function(userId) { - var m = self.memberDict[userId]; + return Object.keys(self.state.memberDict).map(function(userId) { + var m = self.state.memberDict[userId]; return ( ); From 5e7bd1e51fbf7f2186a0e4c4fccd407c745af767 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 21 Oct 2015 15:17:03 +0100 Subject: [PATCH 04/20] Remove empty files --- src/controllers/atoms/ImageView.js | 20 -------------------- src/skins/vector/views/atoms/ImageView.js | 3 --- 2 files changed, 23 deletions(-) delete mode 100644 src/controllers/atoms/ImageView.js diff --git a/src/controllers/atoms/ImageView.js b/src/controllers/atoms/ImageView.js deleted file mode 100644 index d0977e00..00000000 --- a/src/controllers/atoms/ImageView.js +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2015 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. -*/ - -'use strict'; - -module.exports = { -}; diff --git a/src/skins/vector/views/atoms/ImageView.js b/src/skins/vector/views/atoms/ImageView.js index a0d69bcc..676348c0 100644 --- a/src/skins/vector/views/atoms/ImageView.js +++ b/src/skins/vector/views/atoms/ImageView.js @@ -18,11 +18,8 @@ limitations under the License. var React = require('react'); -var ImageViewController = require('../../../../controllers/atoms/ImageView') - module.exports = React.createClass({ displayName: 'ImageView', - mixins: [ImageViewController], // XXX: keyboard shortcuts for managing dialogs should be done by the modal dialog base class omehow, surely... componentDidMount: function() { From a9b093b7f57fbc9cd3d859bf1324562a9a445d4c Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 21 Oct 2015 15:30:04 +0100 Subject: [PATCH 05/20] Remove empty controllers --- src/skins/vector/views/atoms/MessageTimestamp.js | 3 --- src/skins/vector/views/atoms/voip/VideoFeed.js | 3 --- src/skins/vector/views/molecules/EventAsTextTile.js | 2 -- src/skins/vector/views/molecules/MImageTile.js | 3 --- src/skins/vector/views/molecules/MRoomMemberTile.js | 3 --- src/skins/vector/views/molecules/MatrixToolbar.js | 3 --- src/skins/vector/views/molecules/SenderProfile.js | 3 --- src/skins/vector/views/molecules/UnknownMessageTile.js | 3 --- src/skins/vector/views/molecules/voip/VideoView.js | 2 -- 9 files changed, 25 deletions(-) diff --git a/src/skins/vector/views/atoms/MessageTimestamp.js b/src/skins/vector/views/atoms/MessageTimestamp.js index cd0c7a15..32476314 100644 --- a/src/skins/vector/views/atoms/MessageTimestamp.js +++ b/src/skins/vector/views/atoms/MessageTimestamp.js @@ -18,14 +18,11 @@ limitations under the License. var React = require('react'); -var MessageTimestampController = require('matrix-react-sdk/lib/controllers/atoms/MessageTimestamp') - var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; module.exports = React.createClass({ displayName: 'MessageTimestamp', - mixins: [MessageTimestampController], formatDate: function(date) { // date.toLocaleTimeString is completely system dependent. diff --git a/src/skins/vector/views/atoms/voip/VideoFeed.js b/src/skins/vector/views/atoms/voip/VideoFeed.js index 748a431a..9cf28d1b 100644 --- a/src/skins/vector/views/atoms/voip/VideoFeed.js +++ b/src/skins/vector/views/atoms/voip/VideoFeed.js @@ -18,11 +18,8 @@ limitations under the License. var React = require('react'); -var VideoFeedController = require('matrix-react-sdk/lib/controllers/atoms/voip/VideoFeed') - module.exports = React.createClass({ displayName: 'VideoFeed', - mixins: [VideoFeedController], render: function() { return ( diff --git a/src/skins/vector/views/molecules/EventAsTextTile.js b/src/skins/vector/views/molecules/EventAsTextTile.js index e8beddf2..bf757f2f 100644 --- a/src/skins/vector/views/molecules/EventAsTextTile.js +++ b/src/skins/vector/views/molecules/EventAsTextTile.js @@ -18,13 +18,11 @@ limitations under the License. var React = require('react'); -var EventAsTextTileController = require('matrix-react-sdk/lib/controllers/molecules/EventAsTextTile') var sdk = require('matrix-react-sdk') var TextForEvent = require('matrix-react-sdk/lib/TextForEvent'); module.exports = React.createClass({ displayName: 'EventAsTextTile', - mixins: [EventAsTextTileController], render: function() { var MessageTimestamp = sdk.getComponent('atoms.MessageTimestamp'); diff --git a/src/skins/vector/views/molecules/MImageTile.js b/src/skins/vector/views/molecules/MImageTile.js index 59d9cfde..ed61a390 100644 --- a/src/skins/vector/views/molecules/MImageTile.js +++ b/src/skins/vector/views/molecules/MImageTile.js @@ -19,15 +19,12 @@ limitations under the License. var React = require('react'); var filesize = require('filesize'); -var MImageTileController = require('matrix-react-sdk/lib/controllers/molecules/MImageTile') - var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var Modal = require('matrix-react-sdk/lib/Modal'); var sdk = require('matrix-react-sdk') module.exports = React.createClass({ displayName: 'MImageTile', - mixins: [MImageTileController], thumbHeight: function(fullWidth, fullHeight, thumbWidth, thumbHeight) { if (!fullWidth || !fullHeight) { diff --git a/src/skins/vector/views/molecules/MRoomMemberTile.js b/src/skins/vector/views/molecules/MRoomMemberTile.js index 4e163e1d..0048306d 100644 --- a/src/skins/vector/views/molecules/MRoomMemberTile.js +++ b/src/skins/vector/views/molecules/MRoomMemberTile.js @@ -18,14 +18,11 @@ limitations under the License. var React = require('react'); -var MRoomMemberTileController = require('matrix-react-sdk/lib/controllers/molecules/MRoomMemberTile') - var sdk = require('matrix-react-sdk') var TextForEvent = require('matrix-react-sdk/lib/TextForEvent'); module.exports = React.createClass({ displayName: 'MRoomMemberTile', - mixins: [MRoomMemberTileController], getMemberEventText: function() { return TextForEvent.textForEvent(this.props.mxEvent); diff --git a/src/skins/vector/views/molecules/MatrixToolbar.js b/src/skins/vector/views/molecules/MatrixToolbar.js index 0b6c58e0..4a299f14 100644 --- a/src/skins/vector/views/molecules/MatrixToolbar.js +++ b/src/skins/vector/views/molecules/MatrixToolbar.js @@ -20,11 +20,8 @@ var React = require('react'); var sdk = require('matrix-react-sdk') -var MatrixToolbarController = require('matrix-react-sdk/lib/controllers/molecules/MatrixToolbar') - module.exports = React.createClass({ displayName: 'MatrixToolbar', - mixins: [MatrixToolbarController], hideToolbar: function() { var Notifier = sdk.getComponent('organisms.Notifier'); diff --git a/src/skins/vector/views/molecules/SenderProfile.js b/src/skins/vector/views/molecules/SenderProfile.js index 8be3adf2..c09685aa 100644 --- a/src/skins/vector/views/molecules/SenderProfile.js +++ b/src/skins/vector/views/molecules/SenderProfile.js @@ -19,15 +19,12 @@ limitations under the License. var React = require('react'); var classNames = require("classnames"); -var SenderProfileController = require('matrix-react-sdk/lib/controllers/molecules/SenderProfile') - // The Lato WOFF doesn't include sensible combining diacritics, so Chrome chokes on rendering them. // Revert to Arial when this happens, which on OSX works at least. var zalgo = /[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/; module.exports = React.createClass({ displayName: 'SenderProfile', - mixins: [SenderProfileController], render: function() { var mxEvent = this.props.mxEvent; diff --git a/src/skins/vector/views/molecules/UnknownMessageTile.js b/src/skins/vector/views/molecules/UnknownMessageTile.js index d5a20c87..e8cd322a 100644 --- a/src/skins/vector/views/molecules/UnknownMessageTile.js +++ b/src/skins/vector/views/molecules/UnknownMessageTile.js @@ -18,11 +18,8 @@ limitations under the License. var React = require('react'); -var UnknownMessageTileController = require('matrix-react-sdk/lib/controllers/molecules/UnknownMessageTile') - module.exports = React.createClass({ displayName: 'UnknownMessageTile', - mixins: [UnknownMessageTileController], render: function() { var content = this.props.mxEvent.getContent(); diff --git a/src/skins/vector/views/molecules/voip/VideoView.js b/src/skins/vector/views/molecules/voip/VideoView.js index 2bac8869..9dff7cdf 100644 --- a/src/skins/vector/views/molecules/voip/VideoView.js +++ b/src/skins/vector/views/molecules/voip/VideoView.js @@ -20,11 +20,9 @@ var React = require('react'); var sdk = require('matrix-react-sdk') var dis = require('matrix-react-sdk/lib/dispatcher') -var VideoViewController = require('matrix-react-sdk/lib/controllers/molecules/voip/VideoView') module.exports = React.createClass({ displayName: 'VideoView', - mixins: [VideoViewController], componentWillMount: function() { dis.register(this.onAction); From e580cb809d580f2d4d20c6beb6e8a5d322890a15 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 25 Oct 2015 12:33:13 +0000 Subject: [PATCH 06/20] spell out how to set up the deps when developing --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 75fba146..a15917a4 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,14 @@ too, which isn't expressed in Vector's `package.json`. To do this, check out the `develop` branches of these libraries and then use `npm link` to tell Vector about them: -1. Link the react sdk package into the example: +1. `git clone git@github.com:matrix-org/matrix-react-sdk.git` +2. `cd matrix-react-sdk` +3. `git checkout develop` +4. `npm install` +5. `npm start` (to start the dev rebuilder) +6. `cd ../vector-web` +7. Link the react sdk package into the example: `npm link path/to/your/react/sdk` -2. Start the development rebuilder in your react SDK directory: - `npm start` Similarly, you may need to `npm link path/to/your/js/sdk` in your `matrix-react-sdk` directory. From 9217ae8fbba95ea3683f4f9816fdfbc0facfcd07 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 26 Oct 2015 10:30:12 +0000 Subject: [PATCH 07/20] Fix event listener leak --- src/controllers/organisms/RoomView.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index 77359c8f..21027cbf 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -63,6 +63,7 @@ module.exports = { MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); MatrixClientPeg.get().removeListener("Room.name", this.onRoomName); MatrixClientPeg.get().removeListener("RoomMember.typing", this.onRoomMemberTyping); + MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember); } }, From 58bac0fbdc9eda22c062a5327d63a216f21c19a1 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 26 Oct 2015 16:56:44 +0000 Subject: [PATCH 08/20] Add a tag to notifications so they can clobber. Fixes #159. This is the same fix we applied to angular to fix this problem in SYWEB-21. --- src/skins/vector/views/organisms/Notifier.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/skins/vector/views/organisms/Notifier.js b/src/skins/vector/views/organisms/Notifier.js index 8a9b2ffd..b214b4cd 100644 --- a/src/skins/vector/views/organisms/Notifier.js +++ b/src/skins/vector/views/organisms/Notifier.js @@ -66,7 +66,8 @@ var NotifierView = { title, { "body": msg, - "icon": avatarUrl + "icon": avatarUrl, + "tag": "vector" } ); From c98f7f926a7c21daca3caa4714b4628c830768fe Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 27 Oct 2015 10:18:43 +0000 Subject: [PATCH 09/20] Remove stuff that was merged from working space --- src/skins/vector/views/pages/MatrixChat.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/skins/vector/views/pages/MatrixChat.js b/src/skins/vector/views/pages/MatrixChat.js index c045416b..2c2de260 100644 --- a/src/skins/vector/views/pages/MatrixChat.js +++ b/src/skins/vector/views/pages/MatrixChat.js @@ -39,23 +39,6 @@ module.exports = React.createClass({ componentDidMount: function() { window.addEventListener('resize', this.handleResize); this.handleResize(); - - matrixLinkify.onUserClick = function(e, userId) { - // this can really go anywhere.. - // sprout a MemberInfo context menu. - console.log("Context => %s => %s", userId, e.target); - - var MemberInfo = sdk.getComponent('molecules.MemberInfo'); - var member = new RoomMember(null, href); - ContextualMenu.createMenu(MemberInfo, { - member: member, - right: window.innerWidth - e.pageX, - top: e.pageY, - onFinished: function() { - console.log("^_^ All done!"); - } - }); - }; }, componentWillUnmount: function() { From 99e8a54a2782b281bf8de6d7d2d4c5175ddc613e Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 27 Oct 2015 10:46:18 +0000 Subject: [PATCH 10/20] Add linkify handlers --- src/skins/vector/views/pages/MatrixChat.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/skins/vector/views/pages/MatrixChat.js b/src/skins/vector/views/pages/MatrixChat.js index e1558459..2bedd6bf 100644 --- a/src/skins/vector/views/pages/MatrixChat.js +++ b/src/skins/vector/views/pages/MatrixChat.js @@ -25,6 +25,8 @@ var MatrixChatController = require('matrix-react-sdk/lib/controllers/pages/Matri var Loader = require("react-loader"); var dis = require('matrix-react-sdk/lib/dispatcher'); +var Matrix = require("matrix-js-sdk"); +var ContextualMenu = require("../../../../ContextualMenu"); module.exports = React.createClass({ @@ -46,6 +48,22 @@ module.exports = React.createClass({ window.removeEventListener('resize', this.handleResize); }, + onAliasClick: function(event, alias) { + event.preventDefault(); + dis.dispatch({action: 'view_room_alias', room_alias: alias}); + }, + + onUserClick: function(event, userId) { + event.preventDefault(); + var MemberInfo = sdk.getComponent('molecules.MemberInfo'); + var member = new Matrix.RoomMember(null, userId); + ContextualMenu.createMenu(MemberInfo, { + member: member, + right: window.innerWidth - event.pageX, + top: event.pageY + }); + }, + handleResize: function(e) { var hideLhsThreshold = 1000; var showLhsThreshold = 1000; From 05dba9c2d4eb617d24424fd5e38c56f78a9f70df Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 27 Oct 2015 12:59:04 +0000 Subject: [PATCH 11/20] Fix inbound audio This was caused by an being the first thing in the
rather than the