mirror of https://github.com/vector-im/riot-web
				
				
				
			Merge pull request #3188 from matrix-org/travis/soft-logout-non-default-hs
Fix React crash when using a non-default homeserver on soft logoutpull/21833/head
						commit
						a33e5f1918
					
				|  | @ -199,7 +199,7 @@ class MatrixClientPeg { | |||
|      * Throws an error if unable to deduce the homeserver name | ||||
|      * (eg. if the user is not logged in) | ||||
|      */ | ||||
|     getHomeServerName() { | ||||
|     getHomeserverName() { | ||||
|         const matches = /^@.+:(.+)$/.exec(this.matrixClient.credentials.userId); | ||||
|         if (matches === null || matches.length < 1) { | ||||
|             throw new Error("Failed to derive homeserver name from user ID!"); | ||||
|  |  | |||
|  | @ -145,7 +145,7 @@ module.exports = React.createClass({ | |||
|         // too. If it's changed, appending to the list will corrupt it.
 | ||||
|         const my_next_batch = this.nextBatch; | ||||
|         const opts = {limit: 20}; | ||||
|         if (my_server != MatrixClientPeg.getHomeServerName()) { | ||||
|         if (my_server != MatrixClientPeg.getHomeserverName()) { | ||||
|             opts.server = my_server; | ||||
|         } | ||||
|         if (this.state.instanceId) { | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ export default class SoftLogout extends React.Component { | |||
|         const hsUrl = MatrixClientPeg.get().getHomeserverUrl(); | ||||
|         const domainName = hsUrl === defaultServerConfig.hsUrl | ||||
|             ? defaultServerConfig.hsName | ||||
|             : MatrixClientPeg.get().getHomeServerName(); | ||||
|             : MatrixClientPeg.getHomeserverName(); | ||||
| 
 | ||||
|         const userId = MatrixClientPeg.get().getUserId(); | ||||
|         const user = MatrixClientPeg.get().getUser(userId); | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ export default class NetworkDropdown extends React.Component { | |||
| 
 | ||||
|         this.inputTextBox = null; | ||||
| 
 | ||||
|         const server = MatrixClientPeg.getHomeServerName(); | ||||
|         const server = MatrixClientPeg.getHomeserverName(); | ||||
|         this.state = { | ||||
|             expanded: false, | ||||
|             selectedServer: server, | ||||
|  | @ -138,8 +138,8 @@ export default class NetworkDropdown extends React.Component { | |||
|             servers = servers.concat(roomDirectory.servers); | ||||
|         } | ||||
| 
 | ||||
|         if (!servers.includes(MatrixClientPeg.getHomeServerName())) { | ||||
|             servers.unshift(MatrixClientPeg.getHomeServerName()); | ||||
|         if (!servers.includes(MatrixClientPeg.getHomeserverName())) { | ||||
|             servers.unshift(MatrixClientPeg.getHomeserverName()); | ||||
|         } | ||||
| 
 | ||||
|         // For our own HS, we can use the instance_ids given in the third party protocols
 | ||||
|  | @ -148,7 +148,7 @@ export default class NetworkDropdown extends React.Component { | |||
|         // we can only show the default room list.
 | ||||
|         for (const server of servers) { | ||||
|             options.push(this._makeMenuOption(server, null, true)); | ||||
|             if (server === MatrixClientPeg.getHomeServerName()) { | ||||
|             if (server === MatrixClientPeg.getHomeserverName()) { | ||||
|                 options.push(this._makeMenuOption(server, null, false)); | ||||
|                 if (this.props.protocols) { | ||||
|                     for (const proto of Object.keys(this.props.protocols)) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Travis Ralston
						Travis Ralston