diff --git a/.gitignore b/.gitignore
index 13466ce84..7cbd6fc23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
node_modules
vector/bundle.*
lib
+.DS_Store
+key.pem
+cert.pem
+build
diff --git a/.modernizr.json b/.modernizr.json
new file mode 100644
index 000000000..29e620a5b
--- /dev/null
+++ b/.modernizr.json
@@ -0,0 +1,14 @@
+{
+ "minify": true,
+ "classPrefix": "modernizr_",
+ "options": [
+ "setClasses"
+ ],
+ "feature-detects": [
+ "test/css/displaytable",
+ "test/css/flexbox",
+ "test/es5/specification",
+ "test/css/objectfit",
+ "test/storage/localstorage"
+ ]
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index a15917a47..c834e0137 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ setup above, and your changes will cause an instant rebuild.
However, all serious development on Vector happens on the `develop` branch. This typically
depends on the `develop` snapshot versions of `matrix-react-sdk` and `matrix-js-sdk`
-too, which isn't expressed in Vector's `package.json`. To do this, check out
+too, which isn't handled by Vector's `package.json`. To get the right dependencies, check out
the `develop` branches of these libraries and then use `npm link` to tell Vector
about them:
diff --git a/package.json b/package.json
index cab45e836..eb9c3aff9 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"style": "bundle.css",
"scripts": {
"reskindex": "reskindex vector -h src/skins/vector/header",
+ "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
"build:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/bundle.css -c uglifycss --no-watch",
"build:compile": "babel --source-maps -d lib src",
"build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js",
@@ -27,11 +28,13 @@
"filesize": "^3.1.2",
"flux": "~2.0.3",
"linkifyjs": "^2.0.0-beta.4",
+ "modernizr": "^3.1.0",
"matrix-js-sdk": "^0.3.0",
"matrix-react-sdk": "^0.0.2",
"q": "^1.4.1",
"react": "^0.13.3",
- "react-loader": "^1.4.0"
+ "react-loader": "^1.4.0",
+ "sanitize-html": "^1.11.1"
},
"devDependencies": {
"babel": "^5.8.23",
diff --git a/src/DateUtils.js b/src/DateUtils.js
new file mode 100644
index 000000000..fe363586a
--- /dev/null
+++ b/src/DateUtils.js
@@ -0,0 +1,45 @@
+/*
+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';
+
+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 = {
+ formatDate: function(date) {
+ // date.toLocaleTimeString is completely system dependent.
+ // just go 24h for now
+ function pad(n) {
+ return (n < 10 ? '0' : '') + n;
+ }
+
+ var now = new Date();
+ if (date.toDateString() === now.toDateString()) {
+ return pad(date.getHours()) + ':' + pad(date.getMinutes());
+ }
+ else if (now.getTime() - date.getTime() < 6 * 24 * 60 * 60 * 1000) {
+ return days[date.getDay()] + " " + pad(date.getHours()) + ':' + pad(date.getMinutes());
+ }
+ else if (now.getFullYear() === date.getFullYear()) {
+ return days[date.getDay()] + ", " + months[date.getMonth()] + " " + (date.getDay()+1) + " " + pad(date.getHours()) + ':' + pad(date.getMinutes());
+ }
+ else {
+ return days[date.getDay()] + ", " + months[date.getMonth()] + " " + (date.getDay()+1) + " " + date.getFullYear() + " " + pad(date.getHours()) + ':' + pad(date.getMinutes());
+ }
+ }
+}
+
diff --git a/src/controllers/organisms/RoomList.js b/src/controllers/organisms/RoomList.js
index 151a6ca27..964a26481 100644
--- a/src/controllers/organisms/RoomList.js
+++ b/src/controllers/organisms/RoomList.js
@@ -36,11 +36,9 @@ module.exports = {
cli.on("RoomState.events", this.onRoomStateEvents);
cli.on("RoomMember.name", this.onRoomMemberName);
- var rooms = this.getRoomList();
- this.setState({
- roomList: rooms,
- activityMap: {}
- });
+ var s = this.getRoomLists();
+ s.activityMap = {};
+ this.setState(s);
},
componentDidMount: function() {
@@ -87,9 +85,7 @@ module.exports = {
onRoomTimeline: function(ev, room, toStartOfTimeline) {
if (toStartOfTimeline) return;
- var newState = {
- roomList: this.getRoomList()
- };
+ var newState = this.getRoomLists();
if (
room.roomId != this.props.selectedRoom &&
ev.getSender() != MatrixClientPeg.get().credentials.userId)
@@ -123,18 +119,23 @@ module.exports = {
refreshRoomList: function() {
- var rooms = this.getRoomList();
- this.setState({
- roomList: rooms
- });
+ this.setState(this.getRoomLists());
},
- getRoomList: function() {
- return RoomListSorter.mostRecentActivityFirst(
+ getRoomLists: function() {
+ var s = {};
+ var inviteList = [];
+ s.roomList = RoomListSorter.mostRecentActivityFirst(
MatrixClientPeg.get().getRooms().filter(function(room) {
var me = room.getMember(MatrixClientPeg.get().credentials.userId);
+
+ if (me && me.membership == "invite") {
+ inviteList.push(room);
+ return false;
+ }
+
var shouldShowRoom = (
- me && (me.membership == "join" || me.membership == "invite")
+ me && (me.membership == "join")
);
// hiding conf rooms only ever toggles shouldShowRoom to false
if (shouldShowRoom && HIDE_CONFERENCE_CHANS) {
@@ -153,6 +154,8 @@ module.exports = {
return shouldShowRoom;
})
);
+ s.inviteList = RoomListSorter.mostRecentActivityFirst(inviteList);
+ return s;
},
_recheckCallElement: function(selectedRoomId) {
@@ -174,10 +177,10 @@ module.exports = {
}
},
- makeRoomTiles: function() {
+ makeRoomTiles: function(list, isInvite) {
var self = this;
var RoomTile = sdk.getComponent("molecules.RoomTile");
- return this.state.roomList.map(function(room) {
+ return list.map(function(room) {
var selected = room.roomId == self.props.selectedRoom;
return (
Sorry, your browser is not able to run Vector.
++ Buttons and images may appear out of place, communication may + not be possible and all manner of chaos may be unleashed. +
++ Please install Chrome for + the best experience. +
++ Though if you like taking risks with your life, you can still try it + out by clicking that you understand the risks involved. +
+ +