Remove global "auto_join_rooms" flag and use optional "/join" segments in invite links

Generated for channels, not for "normal" rooms.
This commit is contained in:
N-Pex 2024-07-30 18:28:42 +02:00
parent ff7851cb53
commit 59f551de75
7 changed files with 14 additions and 34 deletions

View file

@ -1055,7 +1055,7 @@ export default {
this.$navigation.push(
{
name: "Join",
params: { roomId: util.sanitizeRoomId(this.roomAliasOrId) },
params: { roomId: util.sanitizeRoomId(this.roomAliasOrId), join: this.$route.params.join },
},
0
);

View file

@ -306,7 +306,7 @@ export default {
return roomName ? roomName : "";
},
getRoomInfo() {
if (this.$config.auto_join_rooms) {
if (this.$route.params.join) {
// Auto-join room
this.waitingForRoomCreation = true;
this.$nextTick(() => {

View file

@ -1,14 +1,6 @@
<template>
<div v-if="$config.auto_join_rooms && !roomCreatedByYou() && event.getSender() == $matrix.currentUserId" class="created-room-welcome-header" style="white-space: pre-line;">
{{ $t('room_welcome.info_auto_join',{room: room ? room.name : "",you: $matrix.currentUserDisplayName}) }}
<div class="ma-0">
<a href="#" text @click.prevent="viewProfile">
{{ $t("room_welcome.change") }}
</a>
</div>
</div>
<!-- Contact joined the chat -->
<div v-else class="messageJoin">
<div class="messageJoin">
{{ $t('message.user_joined',{user: eventSenderDisplayName(event)}) }}
</div>
</template>
@ -18,19 +10,6 @@ import messageMixin from "./messageMixin";
export default {
mixins: [messageMixin],
methods: {
viewProfile() {
this.$navigation.push({ name: "Profile" }, 1);
},
roomCreatedByYou() {
const createEvent = this.room && this.room.currentState.getStateEvents("m.room.create", "");
if (createEvent) {
const creatorId = createEvent.getContent().creator;
return (creatorId == this.$matrix.currentUserId);
}
return false;
},
}
};
</script>

View file

@ -1,4 +1,4 @@
import utils from "../plugins/utils";
import utils, { ROOM_TYPE_CHANNEL } from "../plugins/utils";
import roomTypeMixin from "./roomTypeMixin";
export default {
@ -96,7 +96,8 @@ export default {
this.room.getCanonicalAlias(),
this.room.roomId,
this.room.name,
utils.roomDisplayTypeToQueryParam(this.room, this.roomDisplayType)
utils.roomDisplayTypeToQueryParam(this.room, this.roomDisplayType),
this.roomDisplayType == ROOM_TYPE_CHANNEL /* Auto join for channels */
);
}
return null;

View file

@ -1,6 +1,6 @@
<template>
<div class="created-room-welcome-header">
<div v-if="$config.auto_join_rooms" style="white-space: pre-line;">
<div style="white-space: pre-line;">
{{ $t('room_welcome.info_auto_join',{room: room ? room.name : "",you: $matrix.currentUserDisplayName}) }}
<a href="#" text @click.prevent="viewProfile">
{{ $t("room_welcome.change") }}