diff --git a/src/DateUtils.js b/src/DateUtils.js index fe363586ab..3b11b82ccf 100644 --- a/src/DateUtils.js +++ b/src/DateUtils.js @@ -35,10 +35,10 @@ module.exports = { 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()); + return days[date.getDay()] + ", " + months[date.getMonth()] + " " + date.getDate() + " " + 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()); + return days[date.getDay()] + ", " + months[date.getMonth()] + " " + date.getDate() + " " + date.getFullYear() + " " + pad(date.getHours()) + ':' + pad(date.getMinutes()); } } } diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index 196b87a972..95c6a46458 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -69,7 +69,7 @@ class Highlighter { // HTML and plain-text highlighting. var safeHighlight = this.html ? sanitizeHtml(highlights[0], sanitizeHtmlParams) : highlights[0]; - while ((offset = safeSnippet.indexOf(safeHighlight, lastOffset)) >= 0) { + while ((offset = safeSnippet.toLowerCase().indexOf(safeHighlight.toLowerCase(), lastOffset)) >= 0) { // handle preamble if (offset > lastOffset) { var subSnippet = safeSnippet.substring(lastOffset, offset); @@ -150,7 +150,7 @@ module.exports = { var body; if (highlights && highlights.length > 0) { - var highlighter = new Highlighter(isHtml, "mx_MessageTile_searchHighlight", opts.onHighlightClick); + var highlighter = new Highlighter(isHtml, "mx_EventTile_searchHighlight", opts.onHighlightClick); body = highlighter.applyHighlights(safeBody, highlights); } else { diff --git a/src/SlashCommands.js b/src/SlashCommands.js index e6ea7533dc..f5eaff9066 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -99,29 +99,33 @@ var commands = { } // Try to find a room with this alias + // XXX: do we need to do this? Doesn't the JS SDK suppress duplicate attempts to join the same room? var foundRoom = MatrixTools.getRoomForAlias( MatrixClientPeg.get().getRooms(), room_alias ); - if (foundRoom) { // we've already joined this room, view it. - dis.dispatch({ - action: 'view_room', - room_id: foundRoom.roomId - }); - return success(); - } - else { - // attempt to join this alias. - return success( - MatrixClientPeg.get().joinRoom(room_alias).then( - function(room) { - dis.dispatch({ - action: 'view_room', - room_id: room.roomId - }); - }) - ); + + if (foundRoom) { // we've already joined this room, view it if it's not archived. + var me = foundRoom.getMember(MatrixClientPeg.get().credentials.userId); + if (me && me.membership !== "leave") { + dis.dispatch({ + action: 'view_room', + room_id: foundRoom.roomId + }); + return success(); + } } + + // otherwise attempt to join this alias. + return success( + MatrixClientPeg.get().joinRoom(room_alias).then( + function(room) { + dis.dispatch({ + action: 'view_room', + room_id: room.roomId + }); + }) + ); } } return reject("Usage: /join "); diff --git a/src/components/structures/CreateRoom.js b/src/components/structures/CreateRoom.js index d6002fb84c..f520318a0a 100644 --- a/src/components/structures/CreateRoom.js +++ b/src/components/structures/CreateRoom.js @@ -251,13 +251,15 @@ module.exports = React.createClass({ var UserSelector = sdk.getComponent("elements.UserSelector"); var RoomHeader = sdk.getComponent("rooms.RoomHeader"); + var domain = MatrixClientPeg.get().credentials.userId.replace(/^.*:/, ''); + return (