discord-bridge: relay name falls back to the homeserver (patch 0003)
Lint / Shell (shellcheck) (push) Successful in 12s
Lint / Landing page is rendered (matrix (push) Successful in 6s
Lint / No secrets in webhook configs (push) Successful in 9s
Lint / Python (ruff) (push) Successful in 14s
Lint / Secret scan (gitleaks) (push) Successful in 13s
Lint / Shell (shellcheck) (pull_request) Successful in 17s
Lint / Python deps (pip-audit) (push) Successful in 51s
Lint / No Hookshot webhook IDs in README (pull_request) Successful in 7s
Lint / No secrets in webhook configs (pull_request) Successful in 8s
Lint / Python (ruff) (pull_request) Successful in 7s
Lint / Landing page is rendered (matrix (pull_request) Successful in 8s
Lint / Secret scan (gitleaks) (pull_request) Successful in 10s
Lint / JS (eslint) (push) Successful in 12s
Lint / No Hookshot webhook IDs in README (push) Successful in 12s
Lint / Python deps (pip-audit) (pull_request) Successful in 56s
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Shell (shellcheck) (push) Successful in 12s
Lint / Landing page is rendered (matrix (push) Successful in 6s
Lint / No secrets in webhook configs (push) Successful in 9s
Lint / Python (ruff) (push) Successful in 14s
Lint / Secret scan (gitleaks) (push) Successful in 13s
Lint / Shell (shellcheck) (pull_request) Successful in 17s
Lint / Python deps (pip-audit) (push) Successful in 51s
Lint / No Hookshot webhook IDs in README (pull_request) Successful in 7s
Lint / No secrets in webhook configs (pull_request) Successful in 8s
Lint / Python (ruff) (pull_request) Successful in 7s
Lint / Landing page is rendered (matrix (pull_request) Successful in 8s
Lint / Secret scan (gitleaks) (pull_request) Successful in 10s
Lint / JS (eslint) (push) Successful in 12s
Lint / No Hookshot webhook IDs in README (push) Successful in 12s
Lint / Python deps (pip-audit) (pull_request) Successful in 56s
Lint / JS (eslint) (pull_request) Successful in 11s
On 2026-11-23 the bridge lost database access (pg_hba rule wiped by a pve-infra deploy) but kept running. A relayed message then went to Discord as "@jared:matrix.lotusguild.org" with no avatar, because the sender's display name/avatar come only from the bridge's DB copy of room state and that read failed. Patch 0003 reads members through IntentAPI.Member, which uses the same cache but asks Synapse when the cached read fails or misses. Also used for the name in reply embeds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
1 parent
8bf2e6d828
commit
a4a0b0bd0d
2 files changed
+50
No files matched your search
@@ -431,6 +431,9 @@ channel webhook with their own display name.
|
||||
resend, no copy back into Matrix); if not, it retries with the 0001 backoff, checking again before
|
||||
each resend. A webhook post has no dedupe, so this echo check is what keeps those retries from
|
||||
double-posting.
|
||||
- `0003`: the name and avatar on relayed messages come from the bridge's database copy of room
|
||||
membership. If that read fails (e.g. the database is unreachable) or misses, the bridge now asks
|
||||
Synapse instead of posting under the raw Matrix ID with no avatar (happened 2026-11-23).
|
||||
|
||||
**Install (one time):** after this repo's `main` has reached `/opt/matrix-config` on LXC 151, run this
|
||||
on the Proxmox node hosting LXC 109 and 151. It restarts Synapse once and is safe to re-run.
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
diff --git a/lotus_member.go b/lotus_member.go
|
||||
new file mode 100644
|
||||
index 0000000..c9a8e95
|
||||
--- /dev/null
|
||||
+++ b/lotus_member.go
|
||||
@@ -0,0 +1,19 @@
|
||||
+package main
|
||||
+
|
||||
+import (
|
||||
+ "maunium.net/go/mautrix/event"
|
||||
+ "maunium.net/go/mautrix/id"
|
||||
+)
|
||||
+
|
||||
+// lotusMember returns a room member's display name and avatar for relayed
|
||||
+// messages. The bridge normally reads them from its own database copy of room
|
||||
+// state; when that read fails (e.g. the database is unreachable) or the user
|
||||
+// isn't cached yet, it asks the homeserver instead of falling back to the raw
|
||||
+// Matrix ID with no avatar.
|
||||
+func (portal *Portal) lotusMember(userID id.UserID) *event.MemberEventContent {
|
||||
+ member := portal.MainIntent().Member(portal.MXID, userID)
|
||||
+ if member == nil {
|
||||
+ return &event.MemberEventContent{}
|
||||
+ }
|
||||
+ return member
|
||||
+}
|
||||
diff --git a/portal.go b/portal.go
|
||||
index 57ba7f9..17ed1da 100644
|
||||
--- a/portal.go
|
||||
+++ b/portal.go
|
||||
@@ -1450,7 +1450,7 @@ func (br *DiscordBridge) makeMediaProxyURL(mxc id.ContentURI) string {
|
||||
}
|
||||
|
||||
func (portal *Portal) getRelayUserMeta(sender *User) (name, avatarURL string) {
|
||||
- member := portal.bridge.StateStore.GetMember(portal.MXID, sender.MXID)
|
||||
+ member := portal.lotusMember(sender.MXID)
|
||||
name = member.Displayname
|
||||
if name == "" {
|
||||
name = sender.MXID.String()
|
||||
@@ -1502,7 +1502,7 @@ func (portal *Portal) convertReplyMessageToEmbed(eventID id.EventID, url string)
|
||||
targetUser = fmt.Sprintf("<@%s>", puppet.ID)
|
||||
} else if user := portal.bridge.GetUserByMXID(evt.Sender); user != nil && user.DiscordID != "" {
|
||||
targetUser = fmt.Sprintf("<@%s>", user.DiscordID)
|
||||
- } else if member := portal.bridge.StateStore.GetMember(portal.MXID, evt.Sender); member != nil && member.Displayname != "" {
|
||||
+ } else if member := portal.lotusMember(evt.Sender); member.Displayname != "" {
|
||||
targetUser = member.Displayname
|
||||
} else {
|
||||
targetUser = evt.Sender.String()
|
||||
Reference in new issue
Block a user