Append random chars to alias if already taken

Issue #143. Also, show a loading indicator while room creation in progress.
This commit is contained in:
N-Pex 2021-06-29 17:02:40 +02:00
parent 58ef27a765
commit e324355b63
4 changed files with 70 additions and 13 deletions

View file

@ -6,7 +6,7 @@ export default class User {
this.is_guest = is_guest || false
}
normalize = function() {
normalize = function () {
if (this.user_id.startsWith('@') && this.user_id.includes(':')) {
const parts = this.user_id.split(":");
this.user_id = parts[0].substring(1);
@ -14,7 +14,7 @@ export default class User {
}
};
static homeServerUrl = function(home_server) {
static homeServerUrl = function (home_server) {
if (home_server && !home_server.startsWith("https://")) {
return "https://" + home_server;
}
@ -28,4 +28,12 @@ export default class User {
}
return user_id;
}
static serverName(user_id) {
if (user_id && user_id.startsWith('@') && user_id.includes(':')) {
const parts = user_id.split(":");
return parts[1];
}
return user_id;
}
}