l;anded the initial version of the "Create New Topic" form

This commit is contained in:
2025-10-28 22:10:03 -06:00
parent 086954f7b0
commit 9bbc4d9feb
5 changed files with 159 additions and 1 deletions
+40
View File
@@ -12,6 +12,7 @@ package database
import (
"errors"
"fmt"
"strings"
"sync"
"time"
@@ -73,6 +74,45 @@ func lookupUserContact(uid int32) (int32, error) {
return rc, err
}
// FullName returns the full name inside this contact info.
func (ci *ContactInfo) FullName(ps bool) string {
var b strings.Builder
writeSpace := false
if ps && ci.Prefix != nil && *ci.Prefix != "" {
b.WriteString(*ci.Prefix)
writeSpace = true
}
if ci.GivenName != nil && *ci.GivenName != "" {
if writeSpace {
b.WriteString(" ")
}
b.WriteString(*ci.GivenName)
writeSpace = true
}
if ci.MiddleInit != nil && *ci.MiddleInit != "" {
if writeSpace {
b.WriteString(" ")
}
b.WriteString(*ci.MiddleInit)
b.WriteString(".")
writeSpace = true
}
if ci.FamilyName != nil && *ci.FamilyName != "" {
if writeSpace {
b.WriteString(" ")
}
b.WriteString(*ci.FamilyName)
writeSpace = true
}
if ps && ci.Suffix != nil && *ci.Suffix != "" {
if writeSpace {
b.WriteString(" ")
}
b.WriteString(*ci.Suffix)
}
return b.String()
}
/* Save saves the contact info to the database.
* Returns:
* true if the E-mail address on this account has been changed, false if not.