(MINOR) fix Room Topic is empty
fix user has wrong permission
This commit is contained in:
parent
2721417b36
commit
d993436ed5
1 changed files with 11 additions and 15 deletions
|
@ -9,21 +9,13 @@ export class conferenceUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
async createConference(roomId) {
|
async createConference(roomId) {
|
||||||
try {
|
var roomDescription = await this.getRoomTopic(roomId)
|
||||||
var roomDescription = await this.client.getRoomStateEvent(roomId, 'm.room.topic');
|
|
||||||
console.log(roomDescription);
|
|
||||||
roomDescription = roomDescription.topic;
|
|
||||||
const escapedBaseUrl = JITSI_ADMIN_URL.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
const escapedBaseUrl = JITSI_ADMIN_URL.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
|
|
||||||
const regex = new RegExp(escapedBaseUrl + '[^\\s\\n]+');
|
const regex = new RegExp(escapedBaseUrl + '[^\\s\\n]+');
|
||||||
const match = roomDescription.match(regex);
|
const match = roomDescription.match(regex);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match[0];
|
return match[0];
|
||||||
}
|
}
|
||||||
}catch (e) {
|
|
||||||
console.log('The Room description was empty');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var hash = md5(roomId);
|
var hash = md5(roomId);
|
||||||
return JITSI_ADMIN_URL + '/m/' + hash;
|
return JITSI_ADMIN_URL + '/m/' + hash;
|
||||||
|
@ -40,13 +32,8 @@ export class conferenceUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
async changeRoomName(roomId) {
|
async changeRoomName(roomId) {
|
||||||
var roomDescription ='';
|
var roomDescription = await this.getRoomTopic(roomId)
|
||||||
try {
|
|
||||||
roomDescription = await this.client.getRoomStateEvent(roomId, 'm.room.topic');
|
|
||||||
roomDescription = roomDescription.topic;
|
|
||||||
}catch (e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
var conferenceUrl = await this.createConference(roomId);
|
var conferenceUrl = await this.createConference(roomId);
|
||||||
if (!roomDescription.includes(conferenceUrl)) {
|
if (!roomDescription.includes(conferenceUrl)) {
|
||||||
try {
|
try {
|
||||||
|
@ -66,5 +53,14 @@ export class conferenceUtils {
|
||||||
'Diese Hilfeseite anzeigen: !hilfe\n\r'
|
'Diese Hilfeseite anzeigen: !hilfe\n\r'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
async getRoomTopic(roomId){
|
||||||
|
var roomDescription = '';
|
||||||
|
try {
|
||||||
|
roomDescription = await this.client.getRoomStateEvent(roomId, 'm.room.topic');
|
||||||
|
roomDescription = roomDescription.topic;
|
||||||
|
}catch (e) {
|
||||||
|
}
|
||||||
|
return roomDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue