mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Merge pull request #1873 from matrix-org/t3chguy/m.relates_to
Fix Replies :D
This commit is contained in:
commit
7d0af02373
@ -97,7 +97,7 @@ export default class ReplyThread extends React.Component {
|
|||||||
|
|
||||||
// Part of Replies fallback support
|
// Part of Replies fallback support
|
||||||
static stripHTMLReply(html) {
|
static stripHTMLReply(html) {
|
||||||
return html.replace(/^<blockquote data-mx-reply>[\s\S]+?<\/blockquote>/, '');
|
return html.replace(/^<blockquote data-mx-reply>[\s\S]+?<!--end-mx-reply--><\/blockquote>/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Part of Replies fallback support
|
// Part of Replies fallback support
|
||||||
@ -119,7 +119,7 @@ export default class ReplyThread extends React.Component {
|
|||||||
case 'm.text':
|
case 'm.text':
|
||||||
case 'm.notice': {
|
case 'm.notice': {
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
||||||
+ `<br>${html || body}</blockquote>`;
|
+ `<br>${html || body}<!--end-mx-reply--></blockquote>`;
|
||||||
const lines = body.trim().split('\n');
|
const lines = body.trim().split('\n');
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
lines[0] = `<${mxid}> ${lines[0]}`;
|
lines[0] = `<${mxid}> ${lines[0]}`;
|
||||||
@ -129,27 +129,27 @@ export default class ReplyThread extends React.Component {
|
|||||||
}
|
}
|
||||||
case 'm.image':
|
case 'm.image':
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
||||||
+ `<br>sent an image.</blockquote>`;
|
+ `<br>sent an image.<!--end-mx-reply--></blockquote>`;
|
||||||
body = `> <${mxid}> sent an image.\n\n`;
|
body = `> <${mxid}> sent an image.\n\n`;
|
||||||
break;
|
break;
|
||||||
case 'm.video':
|
case 'm.video':
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
||||||
+ `<br>sent a video.</blockquote>`;
|
+ `<br>sent a video.<!--end-mx-reply--></blockquote>`;
|
||||||
body = `> <${mxid}> sent a video.\n\n`;
|
body = `> <${mxid}> sent a video.\n\n`;
|
||||||
break;
|
break;
|
||||||
case 'm.audio':
|
case 'm.audio':
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
||||||
+ `<br>sent an audio file.</blockquote>`;
|
+ `<br>sent an audio file.<!--end-mx-reply--></blockquote>`;
|
||||||
body = `> <${mxid}> sent an audio file.\n\n`;
|
body = `> <${mxid}> sent an audio file.\n\n`;
|
||||||
break;
|
break;
|
||||||
case 'm.file':
|
case 'm.file':
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
||||||
+ `<br>sent a file.</blockquote>`;
|
+ `<br>sent a file.<!--end-mx-reply--></blockquote>`;
|
||||||
body = `> <${mxid}> sent a file.\n\n`;
|
body = `> <${mxid}> sent a file.\n\n`;
|
||||||
break;
|
break;
|
||||||
case 'm.emote': {
|
case 'm.emote': {
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> * `
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> * `
|
||||||
+ `<a href="${userLink}">${mxid}</a><br>${html || body}</blockquote>`;
|
+ `<a href="${userLink}">${mxid}</a><br>${html || body}<!--end-mx-reply--></blockquote>`;
|
||||||
const lines = body.trim().split('\n');
|
const lines = body.trim().split('\n');
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
lines[0] = `* <${mxid}> ${lines[0]}`;
|
lines[0] = `* <${mxid}> ${lines[0]}`;
|
||||||
|
@ -155,9 +155,11 @@ module.exports = withMatrixClient(React.createClass({
|
|||||||
isTwelveHour: PropTypes.bool,
|
isTwelveHour: PropTypes.bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultProps: {
|
getDefaultProps: function() {
|
||||||
// no-op function because onWidgetLoad is optional yet some subcomponents assume its existence
|
return {
|
||||||
onWidgetLoad: function() {},
|
// no-op function because onWidgetLoad is optional yet some sub-components assume its existence
|
||||||
|
onWidgetLoad: function() {},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user