mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 19:26:04 +03:00
allow for sending arbitrary events, also override highlight with
event currently being forwarded while forwardingEvent is set Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
475646a2a7
commit
cc7edbf86d
2 changed files with 12 additions and 10 deletions
|
@ -125,7 +125,7 @@ module.exports = React.createClass({
|
|||
roomId: null,
|
||||
roomLoading: true,
|
||||
|
||||
forwardingMessage: null,
|
||||
forwardingEvent: null,
|
||||
editingRoomSettings: false,
|
||||
uploadingRoomSettings: false,
|
||||
numUnreadMessages: 0,
|
||||
|
@ -454,9 +454,9 @@ module.exports = React.createClass({
|
|||
});
|
||||
|
||||
break;
|
||||
case 'forward_message':
|
||||
case 'forward_event':
|
||||
this.setState({
|
||||
forwardingMessage: payload.content,
|
||||
forwardingEvent: payload.content,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
@ -1203,7 +1203,7 @@ module.exports = React.createClass({
|
|||
this.updateTint();
|
||||
this.setState({
|
||||
editingRoomSettings: false,
|
||||
forwardingMessage: null,
|
||||
forwardingEvent: null,
|
||||
});
|
||||
dis.dispatch({action: 'focus_composer'});
|
||||
},
|
||||
|
@ -1621,8 +1621,8 @@ module.exports = React.createClass({
|
|||
}
|
||||
|
||||
let aux = null;
|
||||
if (this.state.forwardingMessage !== null) {
|
||||
aux = <ForwardMessage onCancelClick={this.onCancelClick} currentRoomId={this.state.room.roomId} content={this.state.forwardingMessage} />;
|
||||
if (this.state.forwardingEvent !== null) {
|
||||
aux = <ForwardMessage onCancelClick={this.onCancelClick} currentRoomId={this.state.room.roomId} mxEvent={this.state.forwardingEvent} />;
|
||||
} else if (this.state.editingRoomSettings) {
|
||||
aux = <RoomSettings ref="room_settings" onSaveClick={this.onSettingsSaveClick} onCancelClick={this.onCancelClick} room={this.state.room} />;
|
||||
} else if (this.state.uploadingRoomSettings) {
|
||||
|
@ -1742,14 +1742,13 @@ module.exports = React.createClass({
|
|||
}
|
||||
|
||||
// console.log("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
|
||||
|
||||
var messagePanel = (
|
||||
<TimelinePanel ref={this._gatherTimelinePanelRef}
|
||||
timelineSet={this.state.room.getUnfilteredTimelineSet()}
|
||||
manageReadReceipts={!UserSettingsStore.getSyncedSetting('hideReadReceipts', false)}
|
||||
manageReadMarkers={true}
|
||||
hidden={hideMessagePanel}
|
||||
highlightedEventId={this.props.highlightedEventId}
|
||||
highlightedEventId={this.state.forwardingEvent ? this.state.forwardingEvent.getId() : this.props.highlightedEventId}
|
||||
eventId={this.props.eventId}
|
||||
eventPixelOffset={this.props.eventPixelOffset}
|
||||
onScroll={ this.onMessageListScroll }
|
||||
|
|
|
@ -26,7 +26,9 @@ module.exports = React.createClass({
|
|||
|
||||
propTypes: {
|
||||
currentRoomId: React.PropTypes.string.isRequired,
|
||||
content: React.PropTypes.object.isRequired,
|
||||
|
||||
/* the MatrixEvent to be forwarded */
|
||||
mxEvent: React.PropTypes.object.isRequired,
|
||||
|
||||
onCancelClick: React.PropTypes.func.isRequired,
|
||||
},
|
||||
|
@ -57,8 +59,9 @@ module.exports = React.createClass({
|
|||
|
||||
onAction: function(payload) {
|
||||
if (payload.action === 'view_room') {
|
||||
const event = this.props.mxEvent;
|
||||
const Client = MatrixClientPeg.get();
|
||||
Client.sendMessage(payload.room_id, this.props.content).done(() => {
|
||||
Client.sendEvent(payload.room_id, event.getType(), event.getContent()).done(() => {
|
||||
dis.dispatch({action: 'message_sent'});
|
||||
}, (err) => {
|
||||
if (err.name === "UnknownDeviceError") {
|
||||
|
|
Loading…
Reference in a new issue