fix multiline topics

This commit is contained in:
emerson 2022-05-02 17:43:21 -04:00
parent 2c381a414d
commit 394a22738e
2 changed files with 2 additions and 2 deletions

View file

@ -71,7 +71,7 @@ export class Channel {
const topicText = response.data["topic"]; const topicText = response.data["topic"];
if (!topicText || this.topic.get("text") !== "") if (!topicText || this.topic.get("text") !== "")
return; return;
this.topic.set("text", topicText); this.topic.set("text", topicText.replace(/\r\n|\r|\n/g, " "));
this.topic.set("timestamp", Date.now().toString(10).substring(0, 10)); this.topic.set("timestamp", Date.now().toString(10).substring(0, 10));
this.topic.set('setter', "matrix"); this.topic.set('setter', "matrix");
}).catch(e => { }).catch(e => {

View file

@ -529,7 +529,7 @@ export class Server {
return; return;
const topicSetter = this.getOrCreateMatrixUser(event["sender"]); const topicSetter = this.getOrCreateMatrixUser(event["sender"]);
const topicTS: string = event["origin_server_ts"].toString(); const topicTS: string = event["origin_server_ts"].toString();
targetChannel.topic.set("text", topicText); targetChannel.topic.set("text", topicText.replace(/\r\n|\r|\n/, " "));
targetChannel.topic.set("timestamp", topicTS.substring(0,10)) targetChannel.topic.set("timestamp", topicTS.substring(0,10))
targetChannel.topic.set('setter', topicSetter.nick); targetChannel.topic.set('setter', topicSetter.nick);