Handle channel mentions where portal hasn't been created

This commit is contained in:
Tulir Asokan
2022-07-03 12:59:34 +03:00
parent 752063f292
commit b0be1a3c08

View File

@@ -175,7 +175,11 @@ func (r *discordTagHTMLRenderer) renderDiscordMention(w util.BufWriter, source [
Receiver: "",
})
if portal != nil {
_, _ = fmt.Fprintf(w, `<a href="https://matrix.to/#/%s?via=%s">%s</a>`, portal.MXID, portal.bridge.AS.HomeserverDomain, portal.Name)
if portal.MXID != "" {
_, _ = fmt.Fprintf(w, `<a href="https://matrix.to/#/%s?via=%s">%s</a>`, portal.MXID, portal.bridge.AS.HomeserverDomain, portal.Name)
} else {
_, _ = w.WriteString(portal.Name)
}
return
}
case *astDiscordCustomEmoji: