Make join button on space hierarchy action in the background (#7041)
This commit is contained in:
parent
43cbb947b6
commit
27e16362b6
7 changed files with 97 additions and 61 deletions
|
@ -308,7 +308,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
}
|
||||
}
|
||||
|
||||
private getInvitingUserId(roomId: string): string {
|
||||
private static getInvitingUserId(roomId: string): string {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const room = cli.getRoom(roomId);
|
||||
if (room && room.getMyMembership() === "invite") {
|
||||
|
@ -318,12 +318,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
}
|
||||
}
|
||||
|
||||
private joinRoomError(payload: ActionPayload) {
|
||||
this.setState({
|
||||
joining: false,
|
||||
joinError: payload.err,
|
||||
});
|
||||
const err = payload.err;
|
||||
public showJoinRoomError(err: Error | MatrixError, roomId: string) {
|
||||
let msg = err.message ? err.message : JSON.stringify(err);
|
||||
logger.log("Failed to join room:", msg);
|
||||
|
||||
|
@ -335,7 +330,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
{ _t("Please contact your homeserver administrator.") }
|
||||
</div>;
|
||||
} else if (err.httpStatus === 404) {
|
||||
const invitingUserId = this.getInvitingUserId(this.state.roomId);
|
||||
const invitingUserId = RoomViewStore.getInvitingUserId(roomId);
|
||||
// only provide a better error message for invites
|
||||
if (invitingUserId) {
|
||||
// if the inviting user is on the same HS, there can only be one cause: they left.
|
||||
|
@ -355,6 +350,14 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
});
|
||||
}
|
||||
|
||||
private joinRoomError(payload: ActionPayload) {
|
||||
this.setState({
|
||||
joining: false,
|
||||
joinError: payload.err,
|
||||
});
|
||||
this.showJoinRoomError(payload.err, this.state.roomId);
|
||||
}
|
||||
|
||||
public reset() {
|
||||
this.state = Object.assign({}, INITIAL_STATE);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue