Skip to content

Commit

Permalink
config: add support for deprecated displayname template variables
Browse files Browse the repository at this point in the history
Fixes #723
  • Loading branch information
tulir committed Oct 2, 2024
1 parent b7b8fd0 commit a9b6493
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pkg/connector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,27 @@ func upgradeConfig(helper up.Helper) {
type DisplaynameParams struct {
types.ContactInfo
Phone string
// Deprecated form of Phone
JID string

// Deprecated legacy fields
JID string
Notify string
VName string
Name string
Short string
}

func (c *Config) FormatDisplayname(jid types.JID, contact types.ContactInfo) string {
var nameBuf strings.Builder
err := c.displaynameTemplate.Execute(&nameBuf, &DisplaynameParams{
ContactInfo: contact,
Phone: "+" + jid.User,
JID: "+" + jid.User,

// Deprecated legacy fields
JID: "+" + jid.User,
Notify: contact.PushName,
VName: contact.BusinessName,
Name: contact.FullName,
Short: contact.FirstName,
})
if err != nil {
panic(err)
Expand Down

0 comments on commit a9b6493

Please sign in to comment.