mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 22:14:58 +08:00
Merge branch 'develop' into rav/scrollpanel_promises
Conflicts: src/components/structures/RoomView.js
This commit is contained in:
commit
89fcf019e1
@ -35,10 +35,10 @@ module.exports = {
|
|||||||
return days[date.getDay()] + " " + pad(date.getHours()) + ':' + pad(date.getMinutes());
|
return days[date.getDay()] + " " + pad(date.getHours()) + ':' + pad(date.getMinutes());
|
||||||
}
|
}
|
||||||
else if (now.getFullYear() === date.getFullYear()) {
|
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 {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class Highlighter {
|
|||||||
// HTML and plain-text highlighting.
|
// HTML and plain-text highlighting.
|
||||||
|
|
||||||
var safeHighlight = this.html ? sanitizeHtml(highlights[0], sanitizeHtmlParams) : highlights[0];
|
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
|
// handle preamble
|
||||||
if (offset > lastOffset) {
|
if (offset > lastOffset) {
|
||||||
var subSnippet = safeSnippet.substring(lastOffset, offset);
|
var subSnippet = safeSnippet.substring(lastOffset, offset);
|
||||||
@ -150,7 +150,7 @@ module.exports = {
|
|||||||
|
|
||||||
var body;
|
var body;
|
||||||
if (highlights && highlights.length > 0) {
|
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);
|
body = highlighter.applyHighlights(safeBody, highlights);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -99,29 +99,33 @@ var commands = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find a room with this alias
|
// 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(
|
var foundRoom = MatrixTools.getRoomForAlias(
|
||||||
MatrixClientPeg.get().getRooms(),
|
MatrixClientPeg.get().getRooms(),
|
||||||
room_alias
|
room_alias
|
||||||
);
|
);
|
||||||
if (foundRoom) { // we've already joined this room, view it.
|
|
||||||
dis.dispatch({
|
if (foundRoom) { // we've already joined this room, view it if it's not archived.
|
||||||
action: 'view_room',
|
var me = foundRoom.getMember(MatrixClientPeg.get().credentials.userId);
|
||||||
room_id: foundRoom.roomId
|
if (me && me.membership !== "leave") {
|
||||||
});
|
dis.dispatch({
|
||||||
return success();
|
action: 'view_room',
|
||||||
}
|
room_id: foundRoom.roomId
|
||||||
else {
|
});
|
||||||
// attempt to join this alias.
|
return success();
|
||||||
return success(
|
}
|
||||||
MatrixClientPeg.get().joinRoom(room_alias).then(
|
|
||||||
function(room) {
|
|
||||||
dis.dispatch({
|
|
||||||
action: 'view_room',
|
|
||||||
room_id: room.roomId
|
|
||||||
});
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 <room_alias>");
|
return reject("Usage: /join <room_alias>");
|
||||||
|
@ -251,13 +251,15 @@ module.exports = React.createClass({
|
|||||||
var UserSelector = sdk.getComponent("elements.UserSelector");
|
var UserSelector = sdk.getComponent("elements.UserSelector");
|
||||||
var RoomHeader = sdk.getComponent("rooms.RoomHeader");
|
var RoomHeader = sdk.getComponent("rooms.RoomHeader");
|
||||||
|
|
||||||
|
var domain = MatrixClientPeg.get().credentials.userId.replace(/^.*:/, '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_CreateRoom">
|
<div className="mx_CreateRoom">
|
||||||
<RoomHeader simpleHeader="Create room" />
|
<RoomHeader simpleHeader="Create room" />
|
||||||
<div className="mx_CreateRoom_body">
|
<div className="mx_CreateRoom_body">
|
||||||
<input type="text" ref="room_name" value={this.state.room_name} onChange={this.onNameChange} placeholder="Name"/> <br />
|
<input type="text" ref="room_name" value={this.state.room_name} onChange={this.onNameChange} placeholder="Name"/> <br />
|
||||||
<textarea className="mx_CreateRoom_description" ref="topic" value={this.state.topic} onChange={this.onTopicChange} placeholder="Topic"/> <br />
|
<textarea className="mx_CreateRoom_description" ref="topic" value={this.state.topic} onChange={this.onTopicChange} placeholder="Topic"/> <br />
|
||||||
<RoomAlias ref="alias" alias={this.state.alias} onChange={this.onAliasChanged}/> <br />
|
<RoomAlias ref="alias" alias={this.state.alias} homeserver={ domain } onChange={this.onAliasChanged}/> <br />
|
||||||
<UserSelector ref="user_selector" selected_users={this.state.invited_users} onChange={this.onInviteChanged}/> <br />
|
<UserSelector ref="user_selector" selected_users={this.state.invited_users} onChange={this.onInviteChanged}/> <br />
|
||||||
<Presets ref="presets" onChange={this.onPresetChanged} preset={this.state.preset}/> <br />
|
<Presets ref="presets" onChange={this.onPresetChanged} preset={this.state.preset}/> <br />
|
||||||
<div>
|
<div>
|
||||||
|
@ -56,8 +56,9 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
if (this.props.homeserver) {
|
if (this.props.homeserver) {
|
||||||
if (curr_val == "") {
|
if (curr_val == "") {
|
||||||
|
var self = this;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
target.value = "#:" + this.props.homeserver;
|
target.value = "#:" + self.props.homeserver;
|
||||||
target.setSelectionRange(1, 1);
|
target.setSelectionRange(1, 1);
|
||||||
}, 0);
|
}, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,8 +54,8 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
if (httpUrl) {
|
if (httpUrl) {
|
||||||
return (
|
return (
|
||||||
<span className="mx_MFileTile">
|
<span className="mx_MFileBody">
|
||||||
<div className="mx_MImageTile_download">
|
<div className="mx_MImageBody_download">
|
||||||
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
|
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
|
||||||
<img src="img/download.png" width="10" height="12"/>
|
<img src="img/download.png" width="10" height="12"/>
|
||||||
Download {text}
|
Download {text}
|
||||||
@ -65,7 +65,7 @@ module.exports = React.createClass({
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
var extra = text ? ': '+text : '';
|
var extra = text ? ': '+text : '';
|
||||||
return <span className="mx_MFileTile">
|
return <span className="mx_MFileBody">
|
||||||
Invalid file{extra}
|
Invalid file{extra}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
@ -109,14 +109,14 @@ module.exports = React.createClass({
|
|||||||
var thumbUrl = this._getThumbUrl();
|
var thumbUrl = this._getThumbUrl();
|
||||||
if (thumbUrl) {
|
if (thumbUrl) {
|
||||||
return (
|
return (
|
||||||
<span className="mx_MImageTile">
|
<span className="mx_MImageBody">
|
||||||
<a href={cli.mxcUrlToHttp(content.url)} onClick={ this.onClick }>
|
<a href={cli.mxcUrlToHttp(content.url)} onClick={ this.onClick }>
|
||||||
<img className="mx_MImageTile_thumbnail" src={thumbUrl}
|
<img className="mx_MImageBody_thumbnail" src={thumbUrl}
|
||||||
alt={content.body} style={imgStyle}
|
alt={content.body} style={imgStyle}
|
||||||
onMouseEnter={this.onImageEnter}
|
onMouseEnter={this.onImageEnter}
|
||||||
onMouseLeave={this.onImageLeave} />
|
onMouseLeave={this.onImageLeave} />
|
||||||
</a>
|
</a>
|
||||||
<div className="mx_MImageTile_download">
|
<div className="mx_MImageBody_download">
|
||||||
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
|
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
|
||||||
<img src="img/download.png" width="10" height="12"/>
|
<img src="img/download.png" width="10" height="12"/>
|
||||||
Download {content.body} ({ content.info && content.info.size ? filesize(content.info.size) : "Unknown size" })
|
Download {content.body} ({ content.info && content.info.size ? filesize(content.info.size) : "Unknown size" })
|
||||||
@ -126,13 +126,13 @@ module.exports = React.createClass({
|
|||||||
);
|
);
|
||||||
} else if (content.body) {
|
} else if (content.body) {
|
||||||
return (
|
return (
|
||||||
<span className="mx_MImageTile">
|
<span className="mx_MImageBody">
|
||||||
Image '{content.body}' cannot be displayed.
|
Image '{content.body}' cannot be displayed.
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span className="mx_MImageTile">
|
<span className="mx_MImageBody">
|
||||||
This image cannot be displayed.
|
This image cannot be displayed.
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
@ -70,8 +70,8 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className="mx_MVideoTile">
|
<span className="mx_MVideoBody">
|
||||||
<video className="mx_MVideoTile" src={cli.mxcUrlToHttp(content.url)} alt={content.body}
|
<video className="mx_MVideoBody" src={cli.mxcUrlToHttp(content.url)} alt={content.body}
|
||||||
controls preload={preload} autoPlay="0"
|
controls preload={preload} autoPlay="0"
|
||||||
height={height} width={width} poster={poster}>
|
height={height} width={width} poster={poster}>
|
||||||
</video>
|
</video>
|
||||||
|
@ -55,19 +55,19 @@ module.exports = React.createClass({
|
|||||||
case "m.emote":
|
case "m.emote":
|
||||||
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||||
return (
|
return (
|
||||||
<span ref="content" className="mx_MEmoteTile mx_MessageTile_content">
|
<span ref="content" className="mx_MEmoteBody mx_EventTile_content">
|
||||||
* { name } { body }
|
* { name } { body }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
case "m.notice":
|
case "m.notice":
|
||||||
return (
|
return (
|
||||||
<span ref="content" className="mx_MNoticeTile mx_MessageTile_content">
|
<span ref="content" className="mx_MNoticeBody mx_EventTile_content">
|
||||||
{ body }
|
{ body }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
default: // including "m.text"
|
default: // including "m.text"
|
||||||
return (
|
return (
|
||||||
<span ref="content" className="mx_MTextTile mx_MessageTile_content">
|
<span ref="content" className="mx_MTextBody mx_EventTile_content">
|
||||||
{ body }
|
{ body }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
@ -34,7 +34,7 @@ module.exports = React.createClass({
|
|||||||
if (text == null || text.length == 0) return null;
|
if (text == null || text.length == 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_EventAsTextTile">
|
<div className="mx_TextualEvent">
|
||||||
{TextForEvent.textForEvent(this.props.mxEvent)}
|
{TextForEvent.textForEvent(this.props.mxEvent)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -24,7 +24,7 @@ module.exports = React.createClass({
|
|||||||
render: function() {
|
render: function() {
|
||||||
var content = this.props.mxEvent.getContent();
|
var content = this.props.mxEvent.getContent();
|
||||||
return (
|
return (
|
||||||
<span className="mx_UnknownMessageTile">
|
<span className="mx_UnknownBody">
|
||||||
{content.body}
|
{content.body}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user