Merge branch 'develop' into luke/room-list-flux
This commit is contained in:
commit
415da3e6ab
3 changed files with 26 additions and 8 deletions
|
@ -85,9 +85,7 @@ function _onStartChatFinished(shouldInvite, addrs) {
|
||||||
if (rooms.length > 0) {
|
if (rooms.length > 0) {
|
||||||
// A Direct Message room already exists for this user, so select a
|
// A Direct Message room already exists for this user, so select a
|
||||||
// room from a list that is similar to the one in MemberInfo panel
|
// room from a list that is similar to the one in MemberInfo panel
|
||||||
const ChatCreateOrReuseDialog = sdk.getComponent(
|
const ChatCreateOrReuseDialog = sdk.getComponent("views.dialogs.ChatCreateOrReuseDialog");
|
||||||
"views.dialogs.ChatCreateOrReuseDialog",
|
|
||||||
);
|
|
||||||
const close = Modal.createTrackedDialog('Create or Reuse', '', ChatCreateOrReuseDialog, {
|
const close = Modal.createTrackedDialog('Create or Reuse', '', ChatCreateOrReuseDialog, {
|
||||||
userId: addrTexts[0],
|
userId: addrTexts[0],
|
||||||
onNewDMClick: () => {
|
onNewDMClick: () => {
|
||||||
|
@ -115,6 +113,15 @@ function _onStartChatFinished(shouldInvite, addrs) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (addrTexts.length === 1) {
|
||||||
|
// Start a new DM chat
|
||||||
|
createRoom({dmUserId: addrTexts[0]}).catch((err) => {
|
||||||
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
|
Modal.createTrackedDialog('Failed to invite user', '', ErrorDialog, {
|
||||||
|
title: _t("Failed to invite user"),
|
||||||
|
description: ((err && err.message) ? err.message : _t("Operation failed")),
|
||||||
|
});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// Start multi user chat
|
// Start multi user chat
|
||||||
let room;
|
let room;
|
||||||
|
|
|
@ -295,7 +295,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className="mx_MFileBody" ref="body">
|
<span className="mx_MFileBody" ref="body">
|
||||||
<div className="mx_MImageBody_download">
|
<div className="mx_MFileBody_download">
|
||||||
<a href="javascript:void(0)" onClick={decrypt}>
|
<a href="javascript:void(0)" onClick={decrypt}>
|
||||||
{ _t("Decrypt %(text)s", { text: text }) }
|
{ _t("Decrypt %(text)s", { text: text }) }
|
||||||
</a>
|
</a>
|
||||||
|
@ -327,7 +327,7 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<span className="mx_MFileBody">
|
<span className="mx_MFileBody">
|
||||||
<div className="mx_MImageBody_download">
|
<div className="mx_MFileBody_download">
|
||||||
<div style={{display: "none"}}>
|
<div style={{display: "none"}}>
|
||||||
{ /*
|
{ /*
|
||||||
* Add dummy copy of the "a" tag
|
* Add dummy copy of the "a" tag
|
||||||
|
@ -347,7 +347,7 @@ module.exports = React.createClass({
|
||||||
if (this.props.tileShape === "file_grid") {
|
if (this.props.tileShape === "file_grid") {
|
||||||
return (
|
return (
|
||||||
<span className="mx_MFileBody">
|
<span className="mx_MFileBody">
|
||||||
<div className="mx_MImageBody_download">
|
<div className="mx_MFileBody_download">
|
||||||
<a className="mx_ImageBody_downloadLink" href={contentUrl} download={fileName} target="_blank">
|
<a className="mx_ImageBody_downloadLink" href={contentUrl} download={fileName} target="_blank">
|
||||||
{ fileName }
|
{ fileName }
|
||||||
</a>
|
</a>
|
||||||
|
@ -360,7 +360,7 @@ module.exports = React.createClass({
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span className="mx_MFileBody">
|
<span className="mx_MFileBody">
|
||||||
<div className="mx_MImageBody_download">
|
<div className="mx_MFileBody_download">
|
||||||
<a href={contentUrl} download={fileName} target="_blank" rel="noopener">
|
<a href={contentUrl} download={fileName} target="_blank" rel="noopener">
|
||||||
<img src={tintedDownloadImageURL} width="12" height="14" ref="downloadImage" />
|
<img src={tintedDownloadImageURL} width="12" height="14" ref="downloadImage" />
|
||||||
{ _t("Download %(text)s", { text: text }) }
|
{ _t("Download %(text)s", { text: text }) }
|
||||||
|
|
|
@ -22,6 +22,7 @@ import dis from "./dispatcher";
|
||||||
import * as Rooms from "./Rooms";
|
import * as Rooms from "./Rooms";
|
||||||
|
|
||||||
import Promise from 'bluebird';
|
import Promise from 'bluebird';
|
||||||
|
import {getAddressType} from "./UserAddress";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new room, and switch to it.
|
* Create a new room, and switch to it.
|
||||||
|
@ -52,7 +53,17 @@ function createRoom(opts) {
|
||||||
createOpts.preset = createOpts.preset || defaultPreset;
|
createOpts.preset = createOpts.preset || defaultPreset;
|
||||||
createOpts.visibility = createOpts.visibility || 'private';
|
createOpts.visibility = createOpts.visibility || 'private';
|
||||||
if (opts.dmUserId && createOpts.invite === undefined) {
|
if (opts.dmUserId && createOpts.invite === undefined) {
|
||||||
createOpts.invite = [opts.dmUserId];
|
switch (getAddressType(opts.dmUserId)) {
|
||||||
|
case 'mx-user-id':
|
||||||
|
createOpts.invite = [opts.dmUserId];
|
||||||
|
break;
|
||||||
|
case 'email':
|
||||||
|
createOpts.invite_3pid = [{
|
||||||
|
id_server: MatrixClientPeg.get().getIdentityServerUrl(true),
|
||||||
|
medium: 'email',
|
||||||
|
address: opts.dmUserId,
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (opts.dmUserId && createOpts.is_direct === undefined) {
|
if (opts.dmUserId && createOpts.is_direct === undefined) {
|
||||||
createOpts.is_direct = true;
|
createOpts.is_direct = true;
|
||||||
|
|
Loading…
Reference in a new issue