Merge branch 'dev'
This commit is contained in:
commit
56edae3e4d
23 changed files with 505 additions and 361 deletions
0
User Research/.gitkeep
Normal file
0
User Research/.gitkeep
Normal file
7
User Research/user-stories.md
Normal file
7
User Research/user-stories.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
**Resilience**
|
||||
|
||||
A free user needs a room link that works for a blocked user. The free user is loyal to the blocked brand.
|
||||
|
||||
A blocked user needs a brand to start from that works. Or at least a place to generate a room link.
|
||||
|
||||
_Idea: Maybe there's just one 'magic link' that always works. There's one site that has the 'magic link' and that's where free users talking with blocked users start._
|
||||
|
|
@ -38,6 +38,9 @@
|
|||
padding: 15px 14px;
|
||||
margin: 0px;
|
||||
height: 48px;
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
&.winner {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
|
@ -50,8 +53,9 @@
|
|||
&.result {
|
||||
border: none;
|
||||
padding: 15px 0px;
|
||||
}
|
||||
.poll-answer-title {
|
||||
&:hover {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
.poll-answer-num-votes {
|
||||
font-size: 0.75rem;
|
||||
|
|
@ -207,6 +211,7 @@
|
|||
// Creation dialog
|
||||
//
|
||||
.poll-create {
|
||||
height: 500px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
.poll-create-dialog-content {
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
@ -253,7 +256,7 @@
|
|||
"download_name": "Download"
|
||||
},
|
||||
"poll_create": {
|
||||
"title": "New Poll",
|
||||
"title": "Create new poll",
|
||||
"create": "Publish",
|
||||
"creating": "Creating poll",
|
||||
"poll_disclosed": "Open - current results are shown at all times.",
|
||||
|
|
@ -267,7 +270,7 @@
|
|||
"please_complete": "Please complete",
|
||||
"answer_required": "Answer can't be empty. Please enter some text or remove this option.",
|
||||
"tip_title": "PRO TIP",
|
||||
"tip_text": "Members will see the poll results after they answer. Close the poll when you're done to show results to everyone in the room..",
|
||||
"tip_text": "Members will see the poll results after they answer. Close the poll when you're done to show results to everyone in the room.",
|
||||
"create_poll_menu_option": "Create poll",
|
||||
"poll_status_closed": "Poll is closed",
|
||||
"poll_status_disclosed": "Results will be shown when poll is closed.",
|
||||
|
|
|
|||
|
|
@ -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": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -174,24 +174,7 @@
|
|||
class="input-area-button text-center flex-grow-0 flex-shrink-1"
|
||||
>
|
||||
<v-btn icon large color="black" @click="showCreatePollDialog = true">
|
||||
<svg width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M3.31462 16.4718C3.31462 16.9496 3.70026 17.3368 4.17609 17.3368L16.1385 17.3368C16.6144 17.3368 17 16.9496 17 16.4718L16.9998 13.6229C16.9998 13.1452 16.6142 12.7579 16.1383 12.7579L4.1764 12.7579C3.70056 12.7579 3.31492 13.1452 3.31492 13.6229L3.31512 16.4718L3.31462 16.4718Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M3.31462 10.4557C3.31462 10.9335 3.70026 11.3208 4.17609 11.3208L11.3428 11.3208C11.8186 11.3208 12.2043 10.9335 12.2043 10.4557L12.2043 7.60711C12.2043 7.12931 11.8186 6.74208 11.3428 6.74208L4.17609 6.74208C3.70026 6.74208 3.31462 7.12932 3.31462 7.60711L3.31462 10.4557Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M3.31451 1.59127L3.31451 4.44011C3.31451 4.91791 3.70016 5.30514 4.17598 5.30514L6.99509 5.30514C7.47093 5.30514 7.85657 4.91791 7.85657 4.44011L7.85637 1.59127C7.85637 1.11347 7.47073 0.726242 6.9949 0.726242L4.17599 0.726242C3.70035 0.726242 3.31452 1.11348 3.31452 1.59127L3.31451 1.59127Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M-2.00529e-05 0.587841L-2.0791e-05 17.4747C-2.08052e-05 17.7995 0.262306 18.0625 0.585404 18.0625L1.38198 18.0625C1.70528 18.0625 1.96741 17.7995 1.96741 17.4747L1.96741 0.587841C1.96741 0.263208 1.70508 -1.14667e-08 1.38198 -2.55897e-08L0.585405 -6.04092e-08C0.261911 -7.45496e-08 -2.00387e-05 0.263213 -2.00529e-05 0.587841Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
<v-icon dark>$vuetify.icons.poll</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
|
|
@ -392,7 +375,7 @@
|
|||
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
import { TimelineWindow, EventTimeline } from "matrix-js-sdk";
|
||||
import { TimelineWindow, EventTimeline, AbortError } from "matrix-js-sdk";
|
||||
import util from "../plugins/utils";
|
||||
import MessageOperations from "./messages/MessageOperations.vue";
|
||||
import AvatarOperations from "./messages/AvatarOperations.vue";
|
||||
|
|
@ -1095,7 +1078,11 @@ export default {
|
|||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.currentSendError = err.toLocaleString();
|
||||
if (err instanceof AbortError || err === "Abort") {
|
||||
this.currentSendError = null;
|
||||
} else {
|
||||
this.currentSendError = err.LocaleString();
|
||||
}
|
||||
this.currentSendOperation = null;
|
||||
this.currentSendProgress = null;
|
||||
});
|
||||
|
|
@ -1105,7 +1092,7 @@ export default {
|
|||
cancelSendAttachment() {
|
||||
this.$refs.attachment.value = null;
|
||||
if (this.currentSendOperation) {
|
||||
this.currentSendOperation.reject("Canceled");
|
||||
this.currentSendOperation.abort();
|
||||
}
|
||||
this.currentSendOperation = null;
|
||||
this.currentImageInput = null;
|
||||
|
|
@ -1290,7 +1277,7 @@ export default {
|
|||
}
|
||||
} else {
|
||||
// When text input emoji picker is clicked
|
||||
this.currentInput = e.data;
|
||||
this.currentInput = `${this.currentInput} ${e.data}`;
|
||||
this.$refs.messageInput.focus();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,93 +1,104 @@
|
|||
<template>
|
||||
<div v-if="showDialog" v-show="room" class="ma-0 pa-0 fullscreen-dialog poll-create">
|
||||
<div class="chat-header">
|
||||
<v-dialog
|
||||
v-model="showDialog"
|
||||
v-show="room"
|
||||
scrollable
|
||||
class="ma-0 pa-0"
|
||||
:width="$vuetify.breakpoint.smAndUp ? '940px' : '95%'"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-container fluid>
|
||||
<div class="room-name no-upper">{{ $t("poll_create.title") }}</div>
|
||||
<v-btn id="btn-close" text class="header-button-right" @click.stop="showDialog = false">
|
||||
<v-icon>close</v-icon>
|
||||
</v-btn>
|
||||
</v-container>
|
||||
</div>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<v-card-text class="poll-create">
|
||||
<div class="text-center">
|
||||
<v-form v-model="isValid" ref="pollcreateform">
|
||||
<v-container fluid class="poll-create-dialog-content">
|
||||
<!-- <v-row cols="12" no-gutters class="ma-0 pa-0">
|
||||
<v-col cols="12">
|
||||
<v-switch
|
||||
v-model="pollIsDisclosed"
|
||||
inset
|
||||
:label="pollIsDisclosed ? $t('poll_create.poll_disclosed') : $t('poll_create.poll_undisclosed')"
|
||||
></v-switch>
|
||||
</v-col>
|
||||
</v-row> -->
|
||||
<v-row cols="12" no-gutters class="ma-0 pa-0">
|
||||
<v-col cols="12" class="ma-0 pa-0">
|
||||
<InputControl
|
||||
v-model="pollQuestion"
|
||||
:label="$t('poll_create.question_label')"
|
||||
:disabled="isCreating"
|
||||
:error="$t('poll_create.please_complete')"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<div class="text-center">
|
||||
<v-form v-model="isValid" ref="pollcreateform">
|
||||
<v-container fluid class="poll-create-dialog-content">
|
||||
<!-- <v-row cols="12" no-gutters class="ma-0 pa-0">
|
||||
<v-col cols="12">
|
||||
<v-switch
|
||||
v-model="pollIsDisclosed"
|
||||
inset
|
||||
:label="pollIsDisclosed ? $t('poll_create.poll_disclosed') : $t('poll_create.poll_undisclosed')"
|
||||
></v-switch>
|
||||
</v-col>
|
||||
</v-row> -->
|
||||
<v-row cols="12" no-gutters class="ma-0 pa-0">
|
||||
<v-col cols="12" class="ma-0 pa-0">
|
||||
<InputControl
|
||||
v-model="pollQuestion"
|
||||
:label="$t('poll_create.question_label')"
|
||||
:disabled="isCreating"
|
||||
:error="$t('poll_create.please_complete')"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-for="(answer, index) in pollAnswers" cols="12" :key="answer.id" no-gutters class="ma-0 pa-0">
|
||||
<v-col cols="12" class="ma-0 pa-0">
|
||||
<InputControl
|
||||
v-model="answer.text"
|
||||
:label="
|
||||
index == 0 ? $t('poll_create.answer_label_1') : $t('poll_create.answer_label_n', { index: index + 1 })
|
||||
"
|
||||
:disabled="isCreating"
|
||||
:error="$t('poll_create.please_complete')"
|
||||
:class="{ deletable: pollAnswers.length > 1 }"
|
||||
ref="answerInput"
|
||||
>
|
||||
<v-btn v-if="pollAnswers.length > 1" icon @click="removeAnswer(index)"><v-icon>delete</v-icon></v-btn>
|
||||
</InputControl>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row v-for="(answer, index) in pollAnswers" cols="12" :key="answer.id" no-gutters class="ma-0 pa-0">
|
||||
<v-col cols="12" class="ma-0 pa-0">
|
||||
<InputControl
|
||||
v-model="answer.text"
|
||||
:label="
|
||||
index == 0 ? $t('poll_create.answer_label_1') : $t('poll_create.answer_label_n', { index: index + 1 })
|
||||
"
|
||||
:disabled="isCreating"
|
||||
:error="$t('poll_create.please_complete')"
|
||||
:class="{ deletable: pollAnswers.length > 1 }"
|
||||
ref="answerInput"
|
||||
>
|
||||
<v-btn v-if="pollAnswers.length > 1" icon @click="removeAnswer(index)"><v-icon>delete</v-icon></v-btn>
|
||||
</InputControl>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row cols="12" no-gutters class="ma-0 pa-0">
|
||||
<v-col class="ma-0 pa-0">
|
||||
<div :class="{'add-answer-button':true, 'clickable': true, 'hidden': addingAnswer}" @click.stop="addAnswer">
|
||||
<img src="@/assets/icons/ic_add.svg" />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-form>
|
||||
<div class="poll-create-status">
|
||||
{{ status }}
|
||||
<v-progress-circular v-if="isCreating" indeterminate color="primary" size="14"></v-progress-circular>
|
||||
<v-row cols="12" no-gutters class="ma-0 pa-0">
|
||||
<v-col class="ma-0 pa-0">
|
||||
<div :class="{'add-answer-button':true, 'clickable': true, 'hidden': addingAnswer}" @click.stop="addAnswer">
|
||||
<img src="@/assets/icons/ic_add.svg" />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row justify="center">
|
||||
<v-col cols="auto">
|
||||
<v-btn
|
||||
id="btn-create-poll"
|
||||
depressed
|
||||
block
|
||||
class="filled-button publish-button"
|
||||
@click.stop="onCreatePoll()"
|
||||
:disabled="isCreating || !publishButtonEnabled"
|
||||
>{{ $t("poll_create.create") }}</v-btn
|
||||
>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-form>
|
||||
<div class="poll-create-status">
|
||||
{{ status }}
|
||||
<v-progress-circular v-if="isCreating" indeterminate color="primary" size="14"></v-progress-circular>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-container>
|
||||
<v-row justify="center">
|
||||
<v-col cols="auto">
|
||||
<v-btn
|
||||
id="btn-create-poll"
|
||||
color="red"
|
||||
depressed
|
||||
block
|
||||
class="filled-button publish-button"
|
||||
@click.stop="onCreatePoll()"
|
||||
:disabled="isCreating || !publishButtonEnabled"
|
||||
>{{ $t("poll_create.create") }}</v-btn
|
||||
>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col cols="auto">
|
||||
<div class="tip">
|
||||
<b>{{ $t("poll_create.tip_title") }}</b
|
||||
>{{ $t("poll_create.tip_text") }}
|
||||
> {{ $t("poll_create.tip_text") }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import roomInfoMixin from "./roomInfoMixin";
|
||||
|
|
@ -209,17 +220,4 @@ export default {
|
|||
<style lang="scss">
|
||||
@import "@/assets/css/chat.scss";
|
||||
@import "@/assets/css/components/poll.scss";
|
||||
.fullscreen-dialog {
|
||||
background-color: white;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
.chat-header {
|
||||
position: static;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -6,27 +6,53 @@
|
|||
<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-4" 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="{}"
|
||||
v-model="selectedProfile.name"
|
||||
></v-text-field>
|
||||
<v-col cols="10" sm="7" class="py-0">
|
||||
<v-select
|
||||
ref="avatar"
|
||||
:items="availableAvatars"
|
||||
cache-items
|
||||
outlined
|
||||
dense
|
||||
@change="selectAvatar"
|
||||
:value="availableAvatars[0]"
|
||||
single-line
|
||||
autofocus
|
||||
>
|
||||
<template v-slot:selection>
|
||||
<v-text-field
|
||||
background-color="transparent"
|
||||
solo
|
||||
flat
|
||||
hide-details
|
||||
@click.native.stop="
|
||||
{
|
||||
}
|
||||
"
|
||||
v-model="selectedProfile.name"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<template v-slot:item="data">
|
||||
<v-avatar size="32">
|
||||
<v-img :src="data.item.image" />
|
||||
</v-avatar>
|
||||
<div class="ms-2">{{ data.item.name }}</div>
|
||||
</template>
|
||||
</v-select>
|
||||
<v-checkbox
|
||||
id="chk-remember-me"
|
||||
class="mt-0"
|
||||
|
|
@ -35,8 +61,8 @@
|
|||
@change="onRememberMe"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="2" sm="5">
|
||||
<v-avatar @click="showAvatarPickerList">
|
||||
<v-col cols="2" sm="5" class="py-0">
|
||||
<v-avatar @click="showAvatarPicker">
|
||||
<v-img v-if="selectedProfile" :src="selectedProfile.image" />
|
||||
</v-avatar>
|
||||
</v-col>
|
||||
|
|
@ -47,72 +73,55 @@
|
|||
<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>
|
||||
</div>
|
||||
|
||||
<input
|
||||
id="room-avatar-picker"
|
||||
ref="avatar"
|
||||
type="file"
|
||||
name="avatar"
|
||||
@change="handlePickedAvatar($event)"
|
||||
accept="image/*"
|
||||
class="d-none"
|
||||
/>
|
||||
|
||||
<div class="join-lang">
|
||||
<h3 class="mb-2">{{ $t("profile.select_language") }}</h3>
|
||||
<v-row class="align-center">
|
||||
<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 +140,7 @@ import SelectLanguageDialog from "./SelectLanguageDialog.vue";
|
|||
|
||||
export default {
|
||||
name: "Join",
|
||||
mixins: [LanguageMixin,rememberMeMixin],
|
||||
mixins: [LanguageMixin, rememberMeMixin],
|
||||
components: {
|
||||
SelectLanguageDialog,
|
||||
},
|
||||
|
|
@ -185,40 +194,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 +219,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 +233,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 +261,23 @@ 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 lastIndex = roomName.lastIndexOf(":");
|
||||
if (roomName && roomName.startsWith("@")) {
|
||||
return roomName.substring(roomName.indexOf("@") + 1, lastIndex);
|
||||
}
|
||||
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 +286,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 +345,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 +365,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;
|
||||
|
|
@ -411,18 +410,20 @@ export default {
|
|||
this.selectedProfile = Object.assign({}, value); // Make a copy, so editing does not destroy data
|
||||
},
|
||||
|
||||
showAvatarPickerList() {
|
||||
this.$refs.avatar.$refs.input.click();
|
||||
showAvatarPicker() {
|
||||
this.$refs.avatar.click();
|
||||
},
|
||||
|
||||
handlePickedAvatar(event) {
|
||||
util.loadAvatarFromFile(event, (image) => {
|
||||
this.selectedProfile.image = image;
|
||||
});
|
||||
},
|
||||
},
|
||||
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 +432,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>
|
||||
|
|
|
|||
|
|
@ -197,11 +197,7 @@
|
|||
|
||||
<script>
|
||||
import SelectLanguageDialog from "./SelectLanguageDialog.vue";
|
||||
import dataUriToBuffer from "data-uri-to-buffer";
|
||||
import ActionRow from "./ActionRow.vue";
|
||||
import ImageResize from "image-resize";
|
||||
const sizeOf = require("image-size");
|
||||
//const dataUriToBuffer = require("data-uri-to-buffer");
|
||||
import util from "../plugins/utils";
|
||||
import profileInfoMixin from "./profileInfoMixin";
|
||||
import LogoutRoomDialog from './LogoutRoomDialog.vue';
|
||||
|
|
@ -318,58 +314,9 @@ export default {
|
|||
},
|
||||
|
||||
handlePickedAvatar(event) {
|
||||
const self = this;
|
||||
if (event.target.files && event.target.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const file = event.target.files[0];
|
||||
if (file.type.startsWith("image/")) {
|
||||
try {
|
||||
var image = e.target.result;
|
||||
|
||||
var dimens = sizeOf(dataUriToBuffer(e.target.result));
|
||||
|
||||
// Need to resize?
|
||||
const w = dimens.width;
|
||||
const h = dimens.height;
|
||||
if (w > 640 || h > 640) {
|
||||
var aspect = w / h;
|
||||
var newWidth = parseInt((w > h ? 640 : 640 * aspect).toFixed());
|
||||
var newHeight = parseInt(
|
||||
(w > h ? 640 / aspect : 640).toFixed()
|
||||
);
|
||||
var imageResize = new ImageResize({
|
||||
format: "png",
|
||||
width: newWidth,
|
||||
height: newHeight,
|
||||
outputType: "blob",
|
||||
});
|
||||
imageResize
|
||||
.play(event.target)
|
||||
.then((img) => {
|
||||
var resizedImageFile = new File([img], file.name, {
|
||||
type: img.type,
|
||||
lastModified: Date.now(),
|
||||
});
|
||||
var reader2 = new FileReader();
|
||||
reader2.onload = (e) => {
|
||||
self.setAvatar(e.target.result);
|
||||
};
|
||||
reader2.readAsDataURL(resizedImageFile);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Resize failed:", err);
|
||||
});
|
||||
} else {
|
||||
self.setAvatar(image);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to get image dimensions: " + error);
|
||||
}
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(event.target.files[0]);
|
||||
}
|
||||
util.loadAvatarFromFile(event, (image) => {
|
||||
this.setAvatar(image);
|
||||
});
|
||||
},
|
||||
setAvatar(image) {
|
||||
const self = this;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ export default {
|
|||
if (relatesTo && relatesTo['m.in_reply_to'])
|
||||
{
|
||||
const content = this.event.getContent();
|
||||
|
||||
const lines = content.body.split('\n').reverse();
|
||||
while (lines.length && !lines[0].startsWith('> ')) lines.shift();
|
||||
// Reply fallback has a blank line after it, so remove it to prevent leading newline
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
import axios from 'axios';
|
||||
import * as ContentHelpers from "matrix-js-sdk/lib/content-helpers";
|
||||
import dataUriToBuffer from "data-uri-to-buffer";
|
||||
import ImageResize from "image-resize";
|
||||
|
||||
const sizeOf = require("image-size");
|
||||
|
||||
var dayjs = require('dayjs');
|
||||
var sha256 = require('js-sha256').sha256;
|
||||
var aesjs = require('aes-js');
|
||||
|
|
@ -21,6 +26,28 @@ var _browserCanRecordAudioF = function () {
|
|||
}
|
||||
var _browserCanRecordAudio = _browserCanRecordAudioF();
|
||||
|
||||
class AbortablePromise extends Promise {
|
||||
constructor(executor) {
|
||||
const aborter = {
|
||||
aborted: false,
|
||||
abortablePromise: undefined,
|
||||
}
|
||||
|
||||
const normalExecutor = function (resolve, reject) {
|
||||
executor(resolve, reject, aborter);
|
||||
};
|
||||
|
||||
super(normalExecutor);
|
||||
this.abort = () => {
|
||||
aborter.aborted = true;
|
||||
if (aborter.abortablePromise) {
|
||||
aborter.abortablePromise.abort();
|
||||
aborter.abortablePromise = undefined;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Util {
|
||||
getAttachment(matrixClient, event, progressCallback, asBlob = false) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
@ -165,7 +192,7 @@ class Util {
|
|||
}
|
||||
let senderContent = replyToEvent.getContent()
|
||||
|
||||
const senderContentBody = Object.getOwnPropertyDescriptor(senderContent,'body') ? senderContent.body : Object.values(senderContent)[0].question.body
|
||||
const senderContentBody = Object.getOwnPropertyDescriptor(senderContent, 'body') ? senderContent.body : Object.values(senderContent)[0].question.body
|
||||
// Prefix the content with reply info (seems to be a legacy thing)
|
||||
const prefix = senderContentBody.split('\n').map((item, index) => {
|
||||
return "> " + (index == 0 ? ("<" + replyToEvent.getSender() + "> ") : "") + item;
|
||||
|
|
@ -190,7 +217,7 @@ class Util {
|
|||
var idx = 0;
|
||||
let answerData = answers.map(a => {
|
||||
idx++;
|
||||
return {id: "" + idx, 'org.matrix.msc1767.text': a.text }
|
||||
return { id: "" + idx, 'org.matrix.msc1767.text': a.text }
|
||||
});
|
||||
const content = {
|
||||
'org.matrix.msc3381.poll.start': {
|
||||
|
|
@ -280,9 +307,14 @@ class Util {
|
|||
}
|
||||
|
||||
sendImage(matrixClient, roomId, file, onUploadProgress) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new AbortablePromise((resolve, reject, aborter) => {
|
||||
const abortionController = aborter;
|
||||
var reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
if (abortionController.aborted) {
|
||||
reject("Aborted");
|
||||
return;
|
||||
}
|
||||
const fileContents = e.target.result;
|
||||
var data = new Uint8Array(fileContents);
|
||||
|
||||
|
|
@ -321,7 +353,8 @@ class Util {
|
|||
|
||||
if (!matrixClient.isRoomEncrypted(roomId)) {
|
||||
// Not encrypted.
|
||||
matrixClient.uploadContent(data, opts)
|
||||
abortionController.abortablePromise = matrixClient.uploadContent(data, opts);
|
||||
abortionController.abortablePromise
|
||||
.then((response) => {
|
||||
messageContent.url = response.content_uri;
|
||||
return this.sendMessage(matrixClient, roomId, "m.room.message", messageContent)
|
||||
|
|
@ -368,7 +401,8 @@ class Util {
|
|||
// Encrypted data sent as octet-stream!
|
||||
opts.type = "application/octet-stream";
|
||||
|
||||
matrixClient.uploadContent(data, opts)
|
||||
abortionController.abortablePromise = matrixClient.uploadContent(data, opts);
|
||||
abortionController.abortablePromise
|
||||
.then((response) => {
|
||||
if (response.error) {
|
||||
return reject(response.error);
|
||||
|
|
@ -431,6 +465,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) {
|
||||
|
|
@ -590,6 +631,60 @@ class Util {
|
|||
});
|
||||
}
|
||||
|
||||
loadAvatarFromFile(event, onLoad) {
|
||||
if (event.target.files && event.target.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const file = event.target.files[0];
|
||||
if (file.type.startsWith("image/")) {
|
||||
try {
|
||||
var image = e.target.result;
|
||||
|
||||
var dimens = sizeOf(dataUriToBuffer(e.target.result));
|
||||
|
||||
// Need to resize?
|
||||
const w = dimens.width;
|
||||
const h = dimens.height;
|
||||
if (w > 640 || h > 640) {
|
||||
var aspect = w / h;
|
||||
var newWidth = parseInt((w > h ? 640 : 640 * aspect).toFixed());
|
||||
var newHeight = parseInt(
|
||||
(w > h ? 640 / aspect : 640).toFixed()
|
||||
);
|
||||
var imageResize = new ImageResize({
|
||||
format: "png",
|
||||
width: newWidth,
|
||||
height: newHeight,
|
||||
outputType: "blob",
|
||||
});
|
||||
imageResize
|
||||
.play(event.target)
|
||||
.then((img) => {
|
||||
var resizedImageFile = new File([img], file.name, {
|
||||
type: img.type,
|
||||
lastModified: Date.now(),
|
||||
});
|
||||
var reader2 = new FileReader();
|
||||
reader2.onload = (e) => {
|
||||
onLoad(e.target.result);
|
||||
};
|
||||
reader2.readAsDataURL(resizedImageFile);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Resize failed:", err);
|
||||
});
|
||||
} else {
|
||||
onLoad(image);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to get image dimensions: " + error);
|
||||
}
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(event.target.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of whole days between the timestamps, at end of that day.
|
||||
* @param {*} ts1
|
||||
|
|
|
|||
|
|
@ -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,12 @@ 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);
|
||||
authRequired = false;
|
||||
}
|
||||
} 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