add RoomView state for message being forwarded
add RoomView action handler for message forward clear forwardingMessage onCancelClick RoomView change var into const in render RoomView load ForwardMessage from rooms.ForwardMessage if there is a messageForwarding object in state show panel in aux Create ForwardMessage class Modify RoomHeader so that it shows the cancel button more greedily reskindex Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
f200e349c9
commit
b6ca16fc2f
4 changed files with 129 additions and 19 deletions
|
@ -183,6 +183,8 @@ import views$rooms$EntityTile from './components/views/rooms/EntityTile';
|
||||||
views$rooms$EntityTile && (module.exports.components['views.rooms.EntityTile'] = views$rooms$EntityTile);
|
views$rooms$EntityTile && (module.exports.components['views.rooms.EntityTile'] = views$rooms$EntityTile);
|
||||||
import views$rooms$EventTile from './components/views/rooms/EventTile';
|
import views$rooms$EventTile from './components/views/rooms/EventTile';
|
||||||
views$rooms$EventTile && (module.exports.components['views.rooms.EventTile'] = views$rooms$EventTile);
|
views$rooms$EventTile && (module.exports.components['views.rooms.EventTile'] = views$rooms$EventTile);
|
||||||
|
import views$rooms$ForwardMessage from './components/views/rooms/ForwardMessage';
|
||||||
|
views$rooms$ForwardMessage && (module.exports.components['views.rooms.ForwardMessage'] = views$rooms$ForwardMessage);
|
||||||
import views$rooms$LinkPreviewWidget from './components/views/rooms/LinkPreviewWidget';
|
import views$rooms$LinkPreviewWidget from './components/views/rooms/LinkPreviewWidget';
|
||||||
views$rooms$LinkPreviewWidget && (module.exports.components['views.rooms.LinkPreviewWidget'] = views$rooms$LinkPreviewWidget);
|
views$rooms$LinkPreviewWidget && (module.exports.components['views.rooms.LinkPreviewWidget'] = views$rooms$LinkPreviewWidget);
|
||||||
import views$rooms$MemberDeviceInfo from './components/views/rooms/MemberDeviceInfo';
|
import views$rooms$MemberDeviceInfo from './components/views/rooms/MemberDeviceInfo';
|
||||||
|
|
|
@ -123,6 +123,8 @@ module.exports = React.createClass({
|
||||||
room: null,
|
room: null,
|
||||||
roomId: null,
|
roomId: null,
|
||||||
roomLoading: true,
|
roomLoading: true,
|
||||||
|
|
||||||
|
forwardingMessage: null,
|
||||||
editingRoomSettings: false,
|
editingRoomSettings: false,
|
||||||
uploadingRoomSettings: false,
|
uploadingRoomSettings: false,
|
||||||
numUnreadMessages: 0,
|
numUnreadMessages: 0,
|
||||||
|
@ -437,6 +439,11 @@ module.exports = React.createClass({
|
||||||
callState: callState
|
callState: callState
|
||||||
});
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'forward_message':
|
||||||
|
this.setState({
|
||||||
|
forwardingMessage: payload.content,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1180,7 +1187,10 @@ module.exports = React.createClass({
|
||||||
onCancelClick: function() {
|
onCancelClick: function() {
|
||||||
console.log("updateTint from onCancelClick");
|
console.log("updateTint from onCancelClick");
|
||||||
this.updateTint();
|
this.updateTint();
|
||||||
this.setState({editingRoomSettings: false});
|
this.setState({
|
||||||
|
editingRoomSettings: false,
|
||||||
|
forwardingMessage: null,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onLeaveClick: function() {
|
onLeaveClick: function() {
|
||||||
|
@ -1462,16 +1472,17 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var RoomHeader = sdk.getComponent('rooms.RoomHeader');
|
const RoomHeader = sdk.getComponent('rooms.RoomHeader');
|
||||||
var MessageComposer = sdk.getComponent('rooms.MessageComposer');
|
const MessageComposer = sdk.getComponent('rooms.MessageComposer');
|
||||||
var RoomSettings = sdk.getComponent("rooms.RoomSettings");
|
const ForwardMessage = sdk.getComponent("rooms.ForwardMessage");
|
||||||
var AuxPanel = sdk.getComponent("rooms.AuxPanel");
|
const RoomSettings = sdk.getComponent("rooms.RoomSettings");
|
||||||
var SearchBar = sdk.getComponent("rooms.SearchBar");
|
const AuxPanel = sdk.getComponent("rooms.AuxPanel");
|
||||||
var ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
const SearchBar = sdk.getComponent("rooms.SearchBar");
|
||||||
var TintableSvg = sdk.getComponent("elements.TintableSvg");
|
const ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
||||||
var RoomPreviewBar = sdk.getComponent("rooms.RoomPreviewBar");
|
const TintableSvg = sdk.getComponent("elements.TintableSvg");
|
||||||
var Loader = sdk.getComponent("elements.Spinner");
|
const RoomPreviewBar = sdk.getComponent("rooms.RoomPreviewBar");
|
||||||
var TimelinePanel = sdk.getComponent("structures.TimelinePanel");
|
const Loader = sdk.getComponent("elements.Spinner");
|
||||||
|
const TimelinePanel = sdk.getComponent("structures.TimelinePanel");
|
||||||
|
|
||||||
if (!this.state.room) {
|
if (!this.state.room) {
|
||||||
if (this.state.roomLoading) {
|
if (this.state.roomLoading) {
|
||||||
|
@ -1599,17 +1610,16 @@ module.exports = React.createClass({
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
var aux = null;
|
let aux = null;
|
||||||
if (this.state.editingRoomSettings) {
|
if (this.state.forwardingMessage !== null) {
|
||||||
|
aux = <ForwardMessage onCancelClick={this.onCancelClick} collapsedRhs={this.props.collapsedRhs} content={this.state.forwardingMessage} />;
|
||||||
|
} else if (this.state.editingRoomSettings) {
|
||||||
aux = <RoomSettings ref="room_settings" onSaveClick={this.onSettingsSaveClick} onCancelClick={this.onCancelClick} room={this.state.room} />;
|
aux = <RoomSettings ref="room_settings" onSaveClick={this.onSettingsSaveClick} onCancelClick={this.onCancelClick} room={this.state.room} />;
|
||||||
}
|
} else if (this.state.uploadingRoomSettings) {
|
||||||
else if (this.state.uploadingRoomSettings) {
|
|
||||||
aux = <Loader/>;
|
aux = <Loader/>;
|
||||||
}
|
} else if (this.state.searching) {
|
||||||
else if (this.state.searching) {
|
|
||||||
aux = <SearchBar ref="search_bar" searchInProgress={this.state.searchInProgress } onCancelClick={this.onCancelSearchClick} onSearch={this.onSearch}/>;
|
aux = <SearchBar ref="search_bar" searchInProgress={this.state.searchInProgress } onCancelClick={this.onCancelSearchClick} onSearch={this.onSearch}/>;
|
||||||
}
|
} else if (!myMember || myMember.membership !== "join") {
|
||||||
else if (!myMember || myMember.membership !== "join") {
|
|
||||||
// We do have a room object for this room, but we're not currently in it.
|
// We do have a room object for this room, but we're not currently in it.
|
||||||
// We may have a 3rd party invite to it.
|
// We may have a 3rd party invite to it.
|
||||||
var inviterName = undefined;
|
var inviterName = undefined;
|
||||||
|
|
95
src/components/views/rooms/ForwardMessage.js
Normal file
95
src/components/views/rooms/ForwardMessage.js
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
Copyright 2017 Vector Creations Ltd
|
||||||
|
Copyright 2017 Michael Telatynski
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
|
import dis from '../../../dispatcher';
|
||||||
|
import KeyCode from "../../../KeyCode";
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = React.createClass({
|
||||||
|
displayName: 'ForwardMessage',
|
||||||
|
|
||||||
|
propTypes: {
|
||||||
|
content: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
|
// true if RightPanel is collapsed
|
||||||
|
collapsedRhs: React.PropTypes.bool,
|
||||||
|
onCancelClick: React.PropTypes.func.isRequired,
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillMount: function() {
|
||||||
|
this._unmounted = false;
|
||||||
|
|
||||||
|
if (!this.props.collapsedRhs) {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'hide_right_panel',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'ui_opacity',
|
||||||
|
sideOpacity: 1.0,
|
||||||
|
middleOpacity: 0.3,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
componentDidMount: function() {
|
||||||
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
|
document.addEventListener('keydown', this._onKeyDown);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount: function() {
|
||||||
|
this._unmounted = true;
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'show_right_panel',
|
||||||
|
});
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'ui_opacity',
|
||||||
|
sideOpacity: 1.0,
|
||||||
|
middleOpacity: 1.0,
|
||||||
|
});
|
||||||
|
dis.unregister(this.dispatcherRef);
|
||||||
|
document.removeEventListener('keydown', this._onKeyDown);
|
||||||
|
},
|
||||||
|
|
||||||
|
onAction: function(payload) {
|
||||||
|
if (payload.action === 'view_room') {
|
||||||
|
MatrixClientPeg.get().sendMessage(payload.room_id, this.props.content);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_onKeyDown: function(ev) {
|
||||||
|
switch (ev.keyCode) {
|
||||||
|
case KeyCode.ESCAPE:
|
||||||
|
this.props.onCancelClick();
|
||||||
|
dis.dispatch({action: 'focus_composer'});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
|
return (
|
||||||
|
<div className="mx_ForwardMessage">
|
||||||
|
|
||||||
|
<h1>Select a room to send the message to</h1>
|
||||||
|
<h2>Use the left sidebar Room List to select forwarding target</h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
|
@ -186,6 +186,9 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
|
|
||||||
save_button = <AccessibleButton className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save</AccessibleButton>;
|
save_button = <AccessibleButton className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save</AccessibleButton>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.props.onCancelClick) {
|
||||||
cancel_button = <CancelButton onClick={this.props.onCancelClick}/>;
|
cancel_button = <CancelButton onClick={this.props.onCancelClick}/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue