mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
Merge pull request #541 from matrix-org/dbkr/dont_preview_matrix_to
Don't do URL previews for matrix.to
This commit is contained in:
commit
884ae0e218
1 changed files with 9 additions and 3 deletions
|
@ -157,18 +157,24 @@ module.exports = React.createClass({
|
|||
// TODO: make this configurable?
|
||||
if (node.textContent.indexOf("/") > -1)
|
||||
{
|
||||
return node;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
var url = node.getAttribute("href");
|
||||
var host = url.match(/^https?:\/\/(.*?)(\/|$)/)[1];
|
||||
|
||||
// never preview matrix.to links (if anything we should give a smart
|
||||
// preview of the room/user they point to: nobody needs to be reminded
|
||||
// what the matrix.to site looks like).
|
||||
if (host == 'matrix.to') return false;
|
||||
|
||||
if (node.textContent.toLowerCase().trim().startsWith(host.toLowerCase())) {
|
||||
// it's a "foo.pl" style link
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// it's a [foo bar](http://foo.com) style link
|
||||
return node;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue