Support authentication flows for login/register

This commit is contained in:
N Pex 2023-04-04 14:30:50 +00:00
parent d86ee3b1e3
commit 0d3781f3aa
11 changed files with 481 additions and 139 deletions

View file

@ -322,6 +322,7 @@ export default {
data() {
return {
waitingForRoomObject: false,
events: [],
currentInput: "",
typingMembers: [],
@ -419,7 +420,6 @@ export default {
computed: {
chatContainer() {
const container = this.$refs.chatContainer;
console.log("GOT CONTAINER", container);
if (this.useVoiceMode) {
return container.$el;
}
@ -547,6 +547,7 @@ export default {
this.$matrix.off("Room.timeline", this.onEvent);
this.$matrix.off("RoomMember.typing", this.onUserTyping);
this.waitingForRoomObject = false;
this.events = [];
this.timelineWindow = null;
this.typingMembers = [];
@ -557,27 +558,32 @@ export default {
this.stopRRTimer();
this.lastRR = null;
if (!this.room) {
// Public room?
if (this.roomId && this.roomId.startsWith("#")) {
this.onRoomNotJoined();
} else if (this.roomId) {
this.onRoomNotJoined(); // Private room we are not joined to. What to do? We redirect to join
// screen, maybe the user has an invite already?
}
if (this.roomId) {
this.$matrix.isJoinedToRoom(this.roomId).then(joined => {
if (!joined) {
this.onRoomNotJoined();
} else {
if (this.room) {
this.onRoomJoined(this.readMarker);
} else {
this.waitingForRoomObject = true;
return; // no room, wait for it (we know we are joined so need to wait for sync to complete)
}
}
});
} else {
this.initialLoadDone = true;
return; // no room
}
// Joined?
if (this.room.hasMembershipState(this.currentUser.user_id, "join")) {
// Yes, load everything
this.onRoomJoined(this.readMarker);
} else {
this.onRoomNotJoined();
}
},
},
room() {
// Were we waiting?
if (this.room && this.room.roomId == this.roomId && this.waitingForRoomObject) {
this.waitingForRoomObject = false;
this.onRoomJoined(this.readMarker);
}
},
showMessageOperations() {
if (this.showMessageOperations) {
this.$nextTick(() => {