mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
Merge pull request #1878 from matrix-org/t3chguy/m.relates_to
Replies: un-break click-to-mention on SenderProfile for reply&preview
This commit is contained in:
commit
337af1643f
1 changed files with 18 additions and 19 deletions
|
@ -202,17 +202,12 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._propsEqual(this.props, nextProps)) {
|
return !this._propsEqual(this.props, nextProps);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
const client = this.props.matrixClient;
|
const client = this.props.matrixClient;
|
||||||
client.removeListener("deviceVerificationChanged",
|
client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
||||||
this.onDeviceVerificationChanged);
|
|
||||||
this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted);
|
this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -227,7 +222,7 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeviceVerificationChanged: function(userId, device) {
|
onDeviceVerificationChanged: function(userId, device) {
|
||||||
if (userId == this.props.mxEvent.getSender()) {
|
if (userId === this.props.mxEvent.getSender()) {
|
||||||
this._verifyEvent(this.props.mxEvent);
|
this._verifyEvent(this.props.mxEvent);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -262,7 +257,7 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to deep-compare readReceipts
|
// need to deep-compare readReceipts
|
||||||
if (key == 'readReceipts') {
|
if (key === 'readReceipts') {
|
||||||
const rA = objA[key];
|
const rA = objA[key];
|
||||||
const rB = objB[key];
|
const rB = objB[key];
|
||||||
if (rA === rB) {
|
if (rA === rB) {
|
||||||
|
@ -336,7 +331,7 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
getReadAvatars: function() {
|
getReadAvatars: function() {
|
||||||
// return early if there are no read receipts
|
// return early if there are no read receipts
|
||||||
if (!this.props.readReceipts || this.props.readReceipts.length === 0) {
|
if (!this.props.readReceipts || this.props.readReceipts.length === 0) {
|
||||||
return (<span className="mx_EventTile_readAvatars"></span>);
|
return (<span className="mx_EventTile_readAvatars" />);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReadReceiptMarker = sdk.getComponent('rooms.ReadReceiptMarker');
|
const ReadReceiptMarker = sdk.getComponent('rooms.ReadReceiptMarker');
|
||||||
|
@ -360,7 +355,7 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
left = (hidden ? MAX_READ_AVATARS - 1 : i) * -receiptOffset;
|
left = (hidden ? MAX_READ_AVATARS - 1 : i) * -receiptOffset;
|
||||||
|
|
||||||
const userId = receipt.roomMember.userId;
|
const userId = receipt.roomMember.userId;
|
||||||
var readReceiptInfo;
|
let readReceiptInfo;
|
||||||
|
|
||||||
if (this.props.readReceiptMap) {
|
if (this.props.readReceiptMap) {
|
||||||
readReceiptInfo = this.props.readReceiptMap[userId];
|
readReceiptInfo = this.props.readReceiptMap[userId];
|
||||||
|
@ -502,17 +497,17 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
mx_EventTile: true,
|
mx_EventTile: true,
|
||||||
mx_EventTile_info: isInfoMessage,
|
mx_EventTile_info: isInfoMessage,
|
||||||
mx_EventTile_12hr: this.props.isTwelveHour,
|
mx_EventTile_12hr: this.props.isTwelveHour,
|
||||||
mx_EventTile_encrypting: this.props.eventSendStatus == 'encrypting',
|
mx_EventTile_encrypting: this.props.eventSendStatus === 'encrypting',
|
||||||
mx_EventTile_sending: isSending,
|
mx_EventTile_sending: isSending,
|
||||||
mx_EventTile_notSent: this.props.eventSendStatus == 'not_sent',
|
mx_EventTile_notSent: this.props.eventSendStatus === 'not_sent',
|
||||||
mx_EventTile_highlight: this.props.tileShape == 'notif' ? false : this.shouldHighlight(),
|
mx_EventTile_highlight: this.props.tileShape === 'notif' ? false : this.shouldHighlight(),
|
||||||
mx_EventTile_selected: this.props.isSelectedEvent,
|
mx_EventTile_selected: this.props.isSelectedEvent,
|
||||||
mx_EventTile_continuation: this.props.tileShape ? '' : this.props.continuation,
|
mx_EventTile_continuation: this.props.tileShape ? '' : this.props.continuation,
|
||||||
mx_EventTile_last: this.props.last,
|
mx_EventTile_last: this.props.last,
|
||||||
mx_EventTile_contextual: this.props.contextual,
|
mx_EventTile_contextual: this.props.contextual,
|
||||||
menu: this.state.menu,
|
menu: this.state.menu,
|
||||||
mx_EventTile_verified: this.state.verified == true,
|
mx_EventTile_verified: this.state.verified === true,
|
||||||
mx_EventTile_unverified: this.state.verified == false,
|
mx_EventTile_unverified: this.state.verified === false,
|
||||||
mx_EventTile_bad: isEncryptionFailure,
|
mx_EventTile_bad: isEncryptionFailure,
|
||||||
mx_EventTile_emote: msgtype === 'm.emote',
|
mx_EventTile_emote: msgtype === 'm.emote',
|
||||||
mx_EventTile_redacted: isRedacted,
|
mx_EventTile_redacted: isRedacted,
|
||||||
|
@ -522,7 +517,8 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
|
|
||||||
const readAvatars = this.getReadAvatars();
|
const readAvatars = this.getReadAvatars();
|
||||||
|
|
||||||
let avatar, sender;
|
let avatar;
|
||||||
|
let sender;
|
||||||
let avatarSize;
|
let avatarSize;
|
||||||
let needsSenderProfile;
|
let needsSenderProfile;
|
||||||
|
|
||||||
|
@ -556,11 +552,14 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
|
|
||||||
if (needsSenderProfile) {
|
if (needsSenderProfile) {
|
||||||
let text = null;
|
let text = null;
|
||||||
if (!this.props.tileShape) {
|
if (!this.props.tileShape || this.props.tileShape === 'reply' || this.props.tileShape === 'reply_preview') {
|
||||||
if (msgtype === 'm.image') text = _td('%(senderName)s sent an image');
|
if (msgtype === 'm.image') text = _td('%(senderName)s sent an image');
|
||||||
else if (msgtype === 'm.video') text = _td('%(senderName)s sent a video');
|
else if (msgtype === 'm.video') text = _td('%(senderName)s sent a video');
|
||||||
else if (msgtype === 'm.file') text = _td('%(senderName)s uploaded a file');
|
else if (msgtype === 'm.file') text = _td('%(senderName)s uploaded a file');
|
||||||
sender = <SenderProfile onClick={this.onSenderProfileClick} mxEvent={this.props.mxEvent} enableFlair={!text} text={text} />;
|
sender = <SenderProfile onClick={this.onSenderProfileClick}
|
||||||
|
mxEvent={this.props.mxEvent}
|
||||||
|
enableFlair={!text}
|
||||||
|
text={text} />;
|
||||||
} else {
|
} else {
|
||||||
sender = <SenderProfile mxEvent={this.props.mxEvent} enableFlair={true} />;
|
sender = <SenderProfile mxEvent={this.props.mxEvent} enableFlair={true} />;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue