Make server_name magix in RoomAlias optional
This commit is contained in:
parent
cd26d1323f
commit
95968bf619
2 changed files with 32 additions and 24 deletions
|
@ -20,6 +20,7 @@ var React = require('react');
|
|||
|
||||
module.exports = {
|
||||
propTypes: {
|
||||
homeserver: React.PropTypes.string,
|
||||
default_alias: React.PropTypes.string
|
||||
},
|
||||
|
||||
|
@ -38,9 +39,10 @@ module.exports = {
|
|||
getAliasLocalpart: function() {
|
||||
var room_alias = this.state.room_alias;
|
||||
|
||||
if (room_alias) {
|
||||
if (room_alias.startsWith("#") && room_alias.endsWith("example.com")) {
|
||||
room_alias = room_alias.slice(1, -":example.com".length);
|
||||
if (room_alias && this.props.homeserver) {
|
||||
var suffix = ":" + this.props.homeserver;
|
||||
if (room_alias.startsWith("#") && room_alias.endsWith(suffix)) {
|
||||
room_alias = room_alias.slice(1, -suffix.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue