Merge branch '376-allow-creation-of-new-direct-chat-using-matrix-id' into 'dev'
Resolve "Allow creation of new direct chat using matrix id" See merge request keanuapp/keanuapp-weblite!123
This commit is contained in:
commit
b6ee49e5f9
16 changed files with 251 additions and 180 deletions
|
|
@ -230,14 +230,17 @@
|
|||
"confirm_text": ""
|
||||
},
|
||||
"join": {
|
||||
"status_joining": "ཁ་བརྡ་ཁང་དུ་འཛུལ་བཞིན་པ།...",
|
||||
"status_logging_in": "ནང་འཛུལ་བྱེད་བཞིན་པ།...",
|
||||
"enter_room": "ནང་དུ་ཞུགས།",
|
||||
"join": "ཁ་བརྡ་ཁང་དུ་འཛུལ།",
|
||||
"joining_as": "ཁྱེད་རང་ཞུགས་བཞིན་པ།:",
|
||||
"remember_me": "ང་དྲན་པར་བྱོས།",
|
||||
"user_name_label": "སྤྱོད་མིང་།",
|
||||
"title": "ཁྱེད་རང་ནང་དུ་ཞུགས་པར་དགའ་བསུ་ཞུ།",
|
||||
"title_user": "",
|
||||
"user_name_label": "སྤྱོད་མིང་།",
|
||||
"remember_me": "ང་དྲན་པར་བྱོས།",
|
||||
"joining_as": "ཁྱེད་རང་ཞུགས་བཞིན་པ།:",
|
||||
"join": "ཁ་བརྡ་ཁང་དུ་འཛུལ།",
|
||||
"join_user": "",
|
||||
"enter_room": "ནང་དུ་ཞུགས།",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "ནང་འཛུལ་བྱེད་བཞིན་པ།...",
|
||||
"status_joining": "ཁ་བརྡ་ཁང་དུ་འཛུལ་བཞིན་པ།...",
|
||||
"join_failed": "ཁ་བརྡ་ཁང་དུ་འཛུལ་ཐུབ་མ་སོང་།",
|
||||
"choose_name": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -164,11 +164,14 @@
|
|||
},
|
||||
"join": {
|
||||
"title": "Welcome you have been invited to join",
|
||||
"title_user": "Welcome you have been invited to chat with",
|
||||
"user_name_label": "User name",
|
||||
"remember_me": "Remember me",
|
||||
"joining_as": "You are joining as:",
|
||||
"join": "Join room",
|
||||
"join_user": "Start chat",
|
||||
"enter_room": "Enter room",
|
||||
"enter_room_user": "Start chat",
|
||||
"status_logging_in": "Logging in...",
|
||||
"status_joining": "Joining room...",
|
||||
"join_failed": "Failed to join room.",
|
||||
|
|
|
|||
|
|
@ -63,14 +63,17 @@
|
|||
"title": "Agregar Amigos"
|
||||
},
|
||||
"join": {
|
||||
"status_joining": "Uniendose a la sala...",
|
||||
"status_logging_in": "Iniciando sesión...",
|
||||
"enter_room": "Entrar habitacion",
|
||||
"join": "Unirse a la sala",
|
||||
"joining_as": "Te estas uniendo como:",
|
||||
"remember_me": "Recordarme",
|
||||
"user_name_label": "Nombre de usuario",
|
||||
"title": "Bienvenido has sido invitado a unirte",
|
||||
"title_user": "",
|
||||
"user_name_label": "Nombre de usuario",
|
||||
"remember_me": "Recordarme",
|
||||
"joining_as": "Te estas uniendo como:",
|
||||
"join": "Unirse a la sala",
|
||||
"join_user": "",
|
||||
"enter_room": "Entrar habitacion",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Iniciando sesión...",
|
||||
"status_joining": "Uniendose a la sala...",
|
||||
"join_failed": "No se pudo unir a la sala.",
|
||||
"choose_name": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -71,14 +71,17 @@
|
|||
"invalid_message": ""
|
||||
},
|
||||
"join": {
|
||||
"joining_as": "Liityt jäsenenä:",
|
||||
"title": "Tervetuloa huoneen {roomName}",
|
||||
"join_guest": "Liity vieraana",
|
||||
"shared_computer": "Tämä on jaettu laite",
|
||||
"join": "Liity huoneeseen",
|
||||
"title_user": "",
|
||||
"user_name_label": "Käyttäjätunnus",
|
||||
"status_joining": "Liittyminen huoneeseen…",
|
||||
"remember_me": "",
|
||||
"joining_as": "Liityt jäsenenä:",
|
||||
"join": "Liity huoneeseen",
|
||||
"join_user": "",
|
||||
"enter_room": "",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Kirjautuminen sisään…",
|
||||
"status_joining": "Liittyminen huoneeseen…",
|
||||
"join_failed": "Huoneeseen liittyminen epäonnistui.",
|
||||
"choose_name": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -149,14 +149,17 @@
|
|||
},
|
||||
"join": {
|
||||
"title": "Bienvenue dans {roomName}",
|
||||
"title_user": "",
|
||||
"user_name_label": "Nom d’utilisateur",
|
||||
"shared_computer": "Ceci est un appareil partagé",
|
||||
"remember_me": "",
|
||||
"joining_as": "Vous rejoignez en tant que :",
|
||||
"join": "Rejoindre le salon",
|
||||
"join_user": "",
|
||||
"enter_room": "",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Connexion en cours…",
|
||||
"status_joining": "Adhésion au salon…",
|
||||
"join_failed": "Impossible de rejoindre le salon.",
|
||||
"joining_as": "Vous rejoignez en tant que :",
|
||||
"join_guest": "Rejoindre comme invité·e",
|
||||
"choose_name": ""
|
||||
},
|
||||
"invite": {
|
||||
|
|
|
|||
|
|
@ -148,14 +148,17 @@
|
|||
},
|
||||
"join": {
|
||||
"title": "Benvenuto/a in {roomName}",
|
||||
"title_user": "",
|
||||
"user_name_label": "Nome utente",
|
||||
"shared_computer": "Questo è un dispositivo condiviso",
|
||||
"remember_me": "",
|
||||
"joining_as": "Ti stai unendo come:",
|
||||
"join": "Unisciti alla stanza",
|
||||
"join_guest": "Unisciti come ospite",
|
||||
"join_user": "",
|
||||
"enter_room": "",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Accesso in corso…",
|
||||
"status_joining": "Unendosi alla stanza…",
|
||||
"join_failed": "Impossibile unirsi alla stanza.",
|
||||
"status_logging_in": "Accesso in corso…",
|
||||
"choose_name": ""
|
||||
},
|
||||
"invite": {
|
||||
|
|
|
|||
|
|
@ -79,11 +79,18 @@
|
|||
"room_deleted": "Rom slettet."
|
||||
},
|
||||
"join": {
|
||||
"join": "Ta del i rom",
|
||||
"status_joining": "Tar del i rom…",
|
||||
"status_logging_in": "Logger inn …",
|
||||
"enter_room": "",
|
||||
"title": "Velkommen til {roomName}",
|
||||
"title_user": "",
|
||||
"user_name_label": "",
|
||||
"remember_me": "",
|
||||
"joining_as": "",
|
||||
"join": "Ta del i rom",
|
||||
"join_user": "",
|
||||
"enter_room": "",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Logger inn …",
|
||||
"status_joining": "Tar del i rom…",
|
||||
"join_failed": "",
|
||||
"choose_name": ""
|
||||
},
|
||||
"profile_info_popup": {
|
||||
|
|
|
|||
|
|
@ -177,11 +177,14 @@
|
|||
},
|
||||
"join": {
|
||||
"title": "Bem-vindo, você foi convidado a participar",
|
||||
"title_user": "",
|
||||
"user_name_label": "Nome do usuário",
|
||||
"remember_me": "Me lembre",
|
||||
"joining_as": "Você está entrando como:",
|
||||
"join": "Entrar na sala",
|
||||
"join_user": "",
|
||||
"enter_room": "Entre na sala",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Fazendo login...",
|
||||
"status_joining": "Entrando na sala...",
|
||||
"join_failed": "Houve uma falha ao entrar na sala.",
|
||||
|
|
|
|||
|
|
@ -99,15 +99,18 @@
|
|||
"title": "Adăugați prieteni"
|
||||
},
|
||||
"join": {
|
||||
"join_failed": "Nu a reușit să intre în cameră.",
|
||||
"status_joining": "Intrarea în cameră...",
|
||||
"status_logging_in": "Autentificare...",
|
||||
"enter_room": "Intră în cameră",
|
||||
"join": "Alăturați-vă camerei",
|
||||
"joining_as": "Vă înscrieți ca:",
|
||||
"remember_me": "Amintește-ți de mine",
|
||||
"user_name_label": "Numele utilizatorului",
|
||||
"title": "Bine ați venit, ați fost invitat să vă alăturați",
|
||||
"title_user": "",
|
||||
"user_name_label": "Numele utilizatorului",
|
||||
"remember_me": "Amintește-ți de mine",
|
||||
"joining_as": "Vă înscrieți ca:",
|
||||
"join": "Alăturați-vă camerei",
|
||||
"join_user": "",
|
||||
"enter_room": "Intră în cameră",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "Autentificare...",
|
||||
"status_joining": "Intrarea în cameră...",
|
||||
"join_failed": "Nu a reușit să intre în cameră.",
|
||||
"choose_name": ""
|
||||
},
|
||||
"profile_info_popup": {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,21 @@
|
|||
"login": {
|
||||
"invalid_message": ""
|
||||
},
|
||||
"join": {
|
||||
"title": "",
|
||||
"title_user": "",
|
||||
"user_name_label": "",
|
||||
"remember_me": "",
|
||||
"joining_as": "",
|
||||
"join": "",
|
||||
"join_user": "",
|
||||
"enter_room": "",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "",
|
||||
"status_joining": "",
|
||||
"join_failed": "",
|
||||
"choose_name": ""
|
||||
},
|
||||
"logout": {
|
||||
"confirm_text": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,15 +121,18 @@
|
|||
"confirm_text": ""
|
||||
},
|
||||
"join": {
|
||||
"join_failed": "مۇنازىرە ئۆيىگە قوشۇلۇش مەغلۇب بولدى.",
|
||||
"status_joining": "مۇنازىرىگە كىرىش...",
|
||||
"status_logging_in": "كىرىش ...",
|
||||
"enter_room": "",
|
||||
"join": "مۇنازىرىگە قوشۇلۇڭ",
|
||||
"joining_as": "سىز تۆۋەندىكىدەك قاتنىشىۋاتىسىز:",
|
||||
"remember_me": "",
|
||||
"user_name_label": "قوللانغۇچى ئىسمى",
|
||||
"title": "{ياتاق ئىسمى} غا خۇش كەپسىز",
|
||||
"title_user": "",
|
||||
"user_name_label": "قوللانغۇچى ئىسمى",
|
||||
"remember_me": "",
|
||||
"joining_as": "سىز تۆۋەندىكىدەك قاتنىشىۋاتىسىز:",
|
||||
"join": "مۇنازىرىگە قوشۇلۇڭ",
|
||||
"join_user": "",
|
||||
"enter_room": "",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "كىرىش ...",
|
||||
"status_joining": "مۇنازىرىگە كىرىش...",
|
||||
"join_failed": "مۇنازىرە ئۆيىگە قوشۇلۇش مەغلۇب بولدى.",
|
||||
"choose_name": ""
|
||||
},
|
||||
"room_welcome": {
|
||||
|
|
|
|||
|
|
@ -179,14 +179,17 @@
|
|||
"done": "完毕"
|
||||
},
|
||||
"join": {
|
||||
"status_joining": "正在加入聊天室...",
|
||||
"status_logging_in": "正在登录中...",
|
||||
"enter_room": "加入聊天室",
|
||||
"join": "加入聊天室",
|
||||
"joining_as": "您以以下身份加入:",
|
||||
"remember_me": "记得我",
|
||||
"user_name_label": "用户名",
|
||||
"title": "欢迎您被邀请加入",
|
||||
"title_user": "",
|
||||
"user_name_label": "用户名",
|
||||
"remember_me": "记得我",
|
||||
"joining_as": "您以以下身份加入:",
|
||||
"join": "加入聊天室",
|
||||
"join_user": "",
|
||||
"enter_room": "加入聊天室",
|
||||
"enter_room_user": "",
|
||||
"status_logging_in": "正在登录中...",
|
||||
"status_joining": "正在加入聊天室...",
|
||||
"join_failed": "加入聊天室失败。",
|
||||
"choose_name": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,25 +6,28 @@
|
|||
<v-avatar class="join-avatar">
|
||||
<v-img v-if="roomAvatar" :src="roomAvatar" />
|
||||
<span v-else class="white--text headline">
|
||||
{{roomName.substring(0, 1).toUpperCase() }}
|
||||
{{ roomName.substring(0, 1).toUpperCase() }}
|
||||
</span>
|
||||
</v-avatar>
|
||||
<div class="join-welcome font-weight-bold">
|
||||
{{ $t("join.title") }}
|
||||
{{ roomId && roomId.startsWith("@") ? $t("join.title_user") : $t("join.title") }}
|
||||
</div>
|
||||
<div class="join-title">
|
||||
{{ roomName | removeHomeServer }}
|
||||
{{ roomName }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-10 join-line">
|
||||
<div class="font-weight-black mb-2" v-if="!currentUser"> Choose a name to use.</div>
|
||||
<hr class="my-10 join-line" />
|
||||
<div class="font-weight-black mb-2" v-if="!currentUser">Choose a name to use.</div>
|
||||
|
||||
<v-row v-if="canEditProfile">
|
||||
<v-col cols="10" sm="7">
|
||||
<v-text-field
|
||||
solo
|
||||
@click.native.stop="{}"
|
||||
@click.native.stop="
|
||||
{
|
||||
}
|
||||
"
|
||||
v-model="selectedProfile.name"
|
||||
></v-text-field>
|
||||
<v-checkbox
|
||||
|
|
@ -47,34 +50,19 @@
|
|||
<div class="d-inline-block">
|
||||
<v-avatar color="#e0e0e0">
|
||||
<v-img v-if="userAvatar" :src="userAvatar" />
|
||||
<span v-else class="white--text headline">{{
|
||||
userAvatarLetter
|
||||
}}</span>
|
||||
<span v-else class="white--text headline">{{ userAvatarLetter }}</span>
|
||||
</v-avatar>
|
||||
</div>
|
||||
{{ userDisplayName }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-btn
|
||||
id="btn-join"
|
||||
class="btn-dark"
|
||||
large
|
||||
@click.stop="handleJoin"
|
||||
:loading="loading"
|
||||
v-if="!currentUser"
|
||||
>{{ $t("join.enter_room") }}</v-btn
|
||||
>
|
||||
<v-btn
|
||||
id="btn-join"
|
||||
class="btn-dark"
|
||||
large
|
||||
block
|
||||
@click.stop="handleJoin"
|
||||
:loading="loading"
|
||||
v-else
|
||||
>{{ $t("join.join") }}</v-btn
|
||||
>
|
||||
<v-btn id="btn-join" class="btn-dark" large @click.stop="handleJoin" :loading="loading" v-if="!currentUser">{{
|
||||
roomId && roomId.startsWith("@") ? $t("join.enter_room_user") : $t("join.enter_room")
|
||||
}}</v-btn>
|
||||
<v-btn id="btn-join" class="btn-dark" large block @click.stop="handleJoin" :loading="loading" v-else>{{
|
||||
roomId && roomId.startsWith("@") ? $t("join.join_user") : $t("join.join")
|
||||
}}</v-btn>
|
||||
|
||||
<div v-if="loadingMessage" class="text-center">{{ loadingMessage }}</div>
|
||||
</div>
|
||||
|
|
@ -86,33 +74,21 @@
|
|||
<v-col v-for="lang in activeLanguage" :key="lang.value">
|
||||
<span class="active">{{ lang.text }}</span>
|
||||
</v-col>
|
||||
<v-col v-for="(lang, key) in getDisplayLanguage.slice(0,3)" :key="key">
|
||||
<v-col v-for="(lang, key) in getDisplayLanguage.slice(0, 3)" :key="key">
|
||||
<button class="inactive" @click="updateLanguage(lang.value)">{{ lang.text }}</button>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn
|
||||
id="btn-select-language"
|
||||
class="language-more"
|
||||
@click="showSelectLanguageDialog = true"
|
||||
>
|
||||
<v-icon >language</v-icon><v-icon >more_horiz</v-icon>
|
||||
<v-btn id="btn-select-language" class="language-more" @click="showSelectLanguageDialog = true">
|
||||
<v-icon>language</v-icon><v-icon>more_horiz</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<SelectLanguageDialog
|
||||
v-model="showSelectLanguageDialog"
|
||||
v-on:close="showSelectLanguageDialog = false"
|
||||
/>
|
||||
<SelectLanguageDialog v-model="showSelectLanguageDialog" v-on:close="showSelectLanguageDialog = false" />
|
||||
</v-row>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-center align-center mt-9">
|
||||
<div class="mr-2">
|
||||
<img
|
||||
src="@/assets/logo.svg"
|
||||
width="32"
|
||||
height="32"
|
||||
class="d-inline"
|
||||
/>
|
||||
<img src="@/assets/logo.svg" width="32" height="32" class="d-inline" />
|
||||
</div>
|
||||
<div>
|
||||
<strong>{{ $t("project.name") }}</strong>
|
||||
|
|
@ -131,7 +107,7 @@ import SelectLanguageDialog from "./SelectLanguageDialog.vue";
|
|||
|
||||
export default {
|
||||
name: "Join",
|
||||
mixins: [LanguageMixin,rememberMeMixin],
|
||||
mixins: [LanguageMixin, rememberMeMixin],
|
||||
components: {
|
||||
SelectLanguageDialog,
|
||||
},
|
||||
|
|
@ -185,40 +161,23 @@ export default {
|
|||
if (!this.$matrix.userAvatar) {
|
||||
return null;
|
||||
}
|
||||
return this.$matrix.matrixClient.mxcUrlToHttp(
|
||||
this.$matrix.userAvatar,
|
||||
80,
|
||||
80,
|
||||
"scale",
|
||||
true
|
||||
);
|
||||
return this.$matrix.matrixClient.mxcUrlToHttp(this.$matrix.userAvatar, 80, 80, "scale", true);
|
||||
},
|
||||
|
||||
userAvatarLetter() {
|
||||
if (!this.currentUser || !this.currentUser.userId) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
this.currentUserDisplayName || this.currentUser.userId.substring(1)
|
||||
)
|
||||
.substring(0, 1)
|
||||
.toUpperCase();
|
||||
return (this.currentUserDisplayName || this.currentUser.userId.substring(1)).substring(0, 1).toUpperCase();
|
||||
},
|
||||
getDisplayLanguage() {
|
||||
let displayLanguages = [...this.getLanguages()];
|
||||
return displayLanguages.filter(lang => lang.display && lang.value !== this.$i18n.locale);
|
||||
return displayLanguages.filter((lang) => lang.display && lang.value !== this.$i18n.locale);
|
||||
},
|
||||
activeLanguage() {
|
||||
let activeLanguages = [...this.getLanguages()]
|
||||
return activeLanguages.filter(lang => lang.value === this.$i18n.locale);
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
removeHomeServer(roomName) {
|
||||
let lastIndexDash = roomName.lastIndexOf("-");
|
||||
let lastIndex = lastIndexDash > 0 ? lastIndexDash : roomName.lastIndexOf(":");
|
||||
return roomName ? roomName.substring(roomName.indexOf("#") + 1, lastIndex) : '';
|
||||
}
|
||||
let activeLanguages = [...this.getLanguages()];
|
||||
return activeLanguages.filter((lang) => lang.value === this.$i18n.locale);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
roomId: {
|
||||
|
|
@ -227,10 +186,8 @@ export default {
|
|||
if (!value || (value && value == oldVal)) {
|
||||
return; // No change.
|
||||
}
|
||||
console.log(
|
||||
"Join: Current room changed to " + (value ? value : "null")
|
||||
);
|
||||
this.roomName = this.roomId;
|
||||
console.log("Join: Current room changed to " + (value ? value : "null"));
|
||||
this.roomName = this.removeHomeServer(this.roomId);
|
||||
|
||||
this.waitingForInfo = true;
|
||||
const self = this;
|
||||
|
|
@ -243,10 +200,7 @@ export default {
|
|||
const room = self.$matrix.getRoom(self.roomAliasOrId);
|
||||
|
||||
// Already joined?
|
||||
if (
|
||||
room &&
|
||||
room.hasMembershipState(self.currentUser.user_id, "join")
|
||||
) {
|
||||
if (room && room.hasMembershipState(self.currentUser.user_id, "join")) {
|
||||
// Yes, go to room
|
||||
self.$navigation.push(
|
||||
{
|
||||
|
|
@ -274,16 +228,21 @@ export default {
|
|||
activeLanguage() {
|
||||
// Null status on language change, we don't know what status we are in so we can't get the right string.
|
||||
this.loadingMessage = null;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
removeHomeServer(roomName) {
|
||||
let lastIndexDash = roomName.lastIndexOf("-");
|
||||
let lastIndex = lastIndexDash > 0 ? lastIndexDash : roomName.lastIndexOf(":");
|
||||
return roomName ? roomName.substring(roomName.indexOf("#") + 1, lastIndex) : "";
|
||||
},
|
||||
getRoomInfo() {
|
||||
if (this.roomId.startsWith("#")) {
|
||||
this.$matrix
|
||||
.getPublicRoomInfo(this.roomId)
|
||||
.then((room) => {
|
||||
console.log("Found room:", room);
|
||||
this.roomName = room.name;
|
||||
this.roomName = this.removeHomeServer(room.name);
|
||||
this.roomAvatar = room.avatar;
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -292,11 +251,26 @@ export default {
|
|||
.finally(() => {
|
||||
this.waitingForInfo = false;
|
||||
});
|
||||
} else if (this.roomId.startsWith("@")) {
|
||||
// Direct chat with user
|
||||
this.$matrix
|
||||
.getPublicUserInfo(this.roomId)
|
||||
.then((info) => {
|
||||
console.log("Got user info:", info);
|
||||
this.roomName = info.displayname;
|
||||
this.roomAvatar = info.avatar;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("Failed to get user info: ", err);
|
||||
})
|
||||
.finally(() => {
|
||||
this.waitingForInfo = false;
|
||||
});
|
||||
} else {
|
||||
// Private room, try to get name
|
||||
const room = this.$matrix.getRoom(this.roomId);
|
||||
if (room) {
|
||||
this.roomName = room.name || this.roomName;
|
||||
this.roomName = this.removeHomeServer(room.name || this.roomName);
|
||||
}
|
||||
this.waitingForInfo = false;
|
||||
}
|
||||
|
|
@ -336,28 +310,16 @@ export default {
|
|||
setProfileData = true;
|
||||
|
||||
// Set display name and avatar directly on the matrix object.
|
||||
if (
|
||||
this.selectedProfile.name &&
|
||||
this.selectedProfile.name.length > 0
|
||||
) {
|
||||
if (this.selectedProfile.name && this.selectedProfile.name.length > 0) {
|
||||
this.$matrix.userDisplayName = this.selectedProfile.name;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!setProfileData ||
|
||||
!this.selectedProfile.name ||
|
||||
this.selectedProfile.name.length == 0
|
||||
) {
|
||||
if (!setProfileData || !this.selectedProfile.name || this.selectedProfile.name.length == 0) {
|
||||
return Promise.resolve(user);
|
||||
} else {
|
||||
console.log(
|
||||
"Join: Set display name to: " + this.selectedProfile.name
|
||||
);
|
||||
return this.$matrix.matrixClient.setDisplayName(
|
||||
this.selectedProfile.name,
|
||||
undefined
|
||||
);
|
||||
console.log("Join: Set display name to: " + this.selectedProfile.name);
|
||||
return this.$matrix.matrixClient.setDisplayName(this.selectedProfile.name, undefined);
|
||||
}
|
||||
}.bind(this)
|
||||
)
|
||||
|
|
@ -368,24 +330,26 @@ export default {
|
|||
return Promise.resolve("no avatar");
|
||||
} else {
|
||||
console.log("Join: Updating avatar");
|
||||
return util.setAvatar(
|
||||
this.$matrix,
|
||||
this.selectedProfile.image,
|
||||
function (progress) {
|
||||
console.log("Progress: " + JSON.stringify(progress));
|
||||
}
|
||||
);
|
||||
return util.setAvatar(this.$matrix, this.selectedProfile.image, function (progress) {
|
||||
console.log("Progress: " + JSON.stringify(progress));
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
)
|
||||
.then(
|
||||
function (ignoreduser) {
|
||||
.then((ignoreduser) => {
|
||||
if (this.roomId.startsWith("@")) {
|
||||
// start direct chat with user
|
||||
return this.$matrix.getOrCreatePrivateChat(this.roomId).then((room) => {
|
||||
this.$matrix.setCurrentRoomId(room.roomId);
|
||||
return room;
|
||||
});
|
||||
} else {
|
||||
console.log("Join: joining room");
|
||||
this.$analytics.event("Invitations", "Room Joined");
|
||||
this.loadingMessage = this.$t("join.status_joining");
|
||||
return this.$matrix.matrixClient.joinRoom(this.roomId);
|
||||
}.bind(this)
|
||||
)
|
||||
}
|
||||
})
|
||||
.then((ignoredRoom) => {
|
||||
this.loading = false;
|
||||
this.loadingMessage = null;
|
||||
|
|
@ -418,11 +382,7 @@ export default {
|
|||
mounted() {
|
||||
this.$matrix.on("Room.myMembership", this.onMyMembership);
|
||||
this.availableAvatars = util.getDefaultAvatars();
|
||||
this.selectAvatar(
|
||||
this.availableAvatars[
|
||||
Math.floor(Math.random() * this.availableAvatars.length)
|
||||
]
|
||||
);
|
||||
this.selectAvatar(this.availableAvatars[Math.floor(Math.random() * this.availableAvatars.length)]);
|
||||
// mounted() is called more than once, so multiple instances of this event
|
||||
// do not necessarily indicate a user was shown the join page more than once.
|
||||
// To analyze this data, segment users into those who have an "Invitations"
|
||||
|
|
@ -431,10 +391,10 @@ export default {
|
|||
},
|
||||
destroyed() {
|
||||
this.$matrix.off("Room.myMembership", this.onMyMembership);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "@/assets/css/join.scss";
|
||||
</style>
|
||||
@import "@/assets/css/join.scss";
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -431,6 +431,13 @@ class Util {
|
|||
return null;
|
||||
}
|
||||
|
||||
sanitizeUserId(userId) {
|
||||
if (userId && userId.match(/^@.+$/)) {
|
||||
return userId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getFirstVisibleElement(parentNode) {
|
||||
const visible = this.findVisibleElements(parentNode);
|
||||
if (visible && visible.length > 0) {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ const routes = [
|
|||
name: 'Join',
|
||||
component: Join
|
||||
},
|
||||
{
|
||||
path: '/user/:userId?',
|
||||
name: 'User',
|
||||
component: Join
|
||||
},
|
||||
{
|
||||
path: '/invite/:roomId?',
|
||||
name: 'Invite',
|
||||
|
|
@ -113,6 +118,11 @@ router.beforeEach((to, from, next) => {
|
|||
//Invite to public room
|
||||
authRequired = false;
|
||||
}
|
||||
} else if (to.name == 'User') {
|
||||
if (to.params.userId) {
|
||||
const roomId = util.sanitizeUserId(to.params.userId);
|
||||
router.app.$matrix.setCurrentRoomId(roomId);
|
||||
}
|
||||
} else if (to.name == 'Invite') {
|
||||
if (to.params.roomId) {
|
||||
const roomId = util.sanitizeRoomId(to.params.roomId);
|
||||
|
|
|
|||
|
|
@ -378,7 +378,6 @@ export default {
|
|||
},
|
||||
|
||||
onRoom(ignoredroom) {
|
||||
console.log("Got room", ignoredroom);
|
||||
this.reloadRooms();
|
||||
this.updateNotificationCount();
|
||||
},
|
||||
|
|
@ -453,7 +452,6 @@ export default {
|
|||
);
|
||||
}
|
||||
});
|
||||
console.log("Reload rooms", updatedRooms);
|
||||
Vue.set(this, "rooms", updatedRooms);
|
||||
const currentRoom = this.getRoom(this.$store.state.currentRoomId);
|
||||
if (this.currentRoom != currentRoom) {
|
||||
|
|
@ -819,17 +817,12 @@ export default {
|
|||
return this.matrixClient.uploadContent(file, opts);
|
||||
},
|
||||
|
||||
getPublicRoomInfo(roomId) {
|
||||
if (!roomId) {
|
||||
return Promise.reject("Invalid parameters");
|
||||
}
|
||||
|
||||
const parts = roomId.split(":");
|
||||
if (parts.length != 2) {
|
||||
return Promise.reject("Unknown room server");
|
||||
}
|
||||
const server = parts[1];
|
||||
|
||||
/**
|
||||
* Get a matrix client that can be used for public queries. If we are logged in, this is the normal
|
||||
* matrix client. If not, we create a temp one with a temp password.
|
||||
* @returns A MatrixClient that can be used for public queries
|
||||
*/
|
||||
getPublicQueryMatrixClient() {
|
||||
var clientPromise;
|
||||
if (this.matrixClient) {
|
||||
clientPromise = this.getMatrixClient().then(() => {
|
||||
|
|
@ -896,6 +889,55 @@ export default {
|
|||
return matrixClient;
|
||||
});
|
||||
}
|
||||
return clientPromise;
|
||||
},
|
||||
|
||||
getPublicUserInfo(userId) {
|
||||
if (!userId) {
|
||||
return Promise.reject("Invalid parameters");
|
||||
}
|
||||
|
||||
const parts = userId.split(":");
|
||||
if (parts.length != 2) {
|
||||
return Promise.reject("Unknown home server");
|
||||
}
|
||||
|
||||
const clientPromise = this.getPublicQueryMatrixClient();
|
||||
let matrixClient;
|
||||
return clientPromise
|
||||
.then((client) => {
|
||||
matrixClient = client;
|
||||
return client.getProfileInfo(userId);
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.avatar_url) {
|
||||
response.avatar = matrixClient.mxcUrlToHttp(
|
||||
response.avatar_url,
|
||||
80,
|
||||
80,
|
||||
"scale",
|
||||
true
|
||||
);
|
||||
}
|
||||
return Promise.resolve(response);
|
||||
})
|
||||
.catch((err) => {
|
||||
return Promise.reject("Failed to find user info: " + err);
|
||||
});
|
||||
},
|
||||
|
||||
getPublicRoomInfo(roomId) {
|
||||
if (!roomId) {
|
||||
return Promise.reject("Invalid parameters");
|
||||
}
|
||||
|
||||
const parts = roomId.split(":");
|
||||
if (parts.length != 2) {
|
||||
return Promise.reject("Unknown room server");
|
||||
}
|
||||
const server = parts[1];
|
||||
|
||||
const clientPromise = this.getPublicQueryMatrixClient();
|
||||
|
||||
const findOrGetMore = function _findOrGetMore(client, response) {
|
||||
for (var room of response.chunk) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue