Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 0b0f1274 rédigé par Sorunome's avatar Sorunome
Parcourir les fichiers

Merge remote-tracking branch 'origin/soru/channels' into develop

parents 33c780d9 98f4fda6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -150,6 +150,9 @@ export class DiscordMessageProcessor { ...@@ -150,6 +150,9 @@ export class DiscordMessageProcessor {
public InsertChannel(node: IDiscordNode, msg: Discord.Message, html: boolean = false): string { public InsertChannel(node: IDiscordNode, msg: Discord.Message, html: boolean = false): string {
const id = node.id; const id = node.id;
const channel = msg.guild.channels.get(id); const channel = msg.guild.channels.get(id);
if (!channel) {
return html ? `&lt;#${escapeHtml(id)}&gt;` : `<#${id}>`;
}
const channelStr = escapeHtml(channel ? "#" + channel.name : "#" + id); const channelStr = escapeHtml(channel ? "#" + channel.name : "#" + id);
if (!html) { if (!html) {
return channelStr; return channelStr;
......
...@@ -262,11 +262,11 @@ describe("DiscordMessageProcessor", () => { ...@@ -262,11 +262,11 @@ describe("DiscordMessageProcessor", () => {
const msg = new MockMessage(channel) as any; const msg = new MockMessage(channel) as any;
const content = { id: "123456789" }; const content = { id: "123456789" };
let reply = processor.InsertChannel(content, msg); let reply = processor.InsertChannel(content, msg);
Chai.assert.equal(reply, "#123456789"); Chai.assert.equal(reply, "<#123456789>");
reply = processor.InsertChannel(content, msg, true); reply = processor.InsertChannel(content, msg, true);
Chai.assert.equal(reply, Chai.assert.equal(reply,
"<a href=\"https://matrix.to/#/#_discord_123_123456789:localhost\">#123456789</a>"); "&lt;#123456789&gt;");
}); });
it("processes channels correctly", () => { it("processes channels correctly", () => {
const processor = new DiscordMessageProcessor( const processor = new DiscordMessageProcessor(
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter