fix: normalize mayor identity to 'mayor/' for mail routing
The addressToIdentity function was stripping the trailing slash from 'mayor/' addresses, causing a mismatch with beads messages that have assignee 'mayor/'. This fix ensures mayor addresses always use 'mayor/' for consistent mail routing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -215,19 +215,20 @@ func ParseMessageType(s string) MessageType {
|
||||
// addressToIdentity converts a GGT address to a beads identity.
|
||||
//
|
||||
// Examples:
|
||||
// - "mayor/" → "mayor"
|
||||
// - "mayor/" → "mayor/"
|
||||
// - "mayor" → "mayor/"
|
||||
// - "gastown/Toast" → "gastown-Toast"
|
||||
// - "gastown/refinery" → "gastown-refinery"
|
||||
// - "gastown/" → "gastown" (rig broadcast)
|
||||
func addressToIdentity(address string) string {
|
||||
// Trim trailing slash
|
||||
if len(address) > 0 && address[len(address)-1] == '/' {
|
||||
address = address[:len(address)-1]
|
||||
// Mayor special case - always use "mayor/" for consistency
|
||||
if address == "mayor" || address == "mayor/" {
|
||||
return "mayor/"
|
||||
}
|
||||
|
||||
// Mayor special case
|
||||
if address == "mayor" {
|
||||
return "mayor"
|
||||
// Trim trailing slash for non-mayor addresses
|
||||
if len(address) > 0 && address[len(address)-1] == '/' {
|
||||
address = address[:len(address)-1]
|
||||
}
|
||||
|
||||
// Replace / with - for beads identity
|
||||
|
||||
Reference in New Issue
Block a user