More profile fields for BareRTC cards
This commit is contained in:
parent
f9a2d471f5
commit
bb0e7fa2fc
|
@ -4,11 +4,14 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.nonshy.com/nonshy/website/pkg/config"
|
||||
"code.nonshy.com/nonshy/website/pkg/controller/api"
|
||||
"code.nonshy.com/nonshy/website/pkg/log"
|
||||
"code.nonshy.com/nonshy/website/pkg/models"
|
||||
"code.nonshy.com/nonshy/website/pkg/templates"
|
||||
"code.nonshy.com/nonshy/website/pkg/utility"
|
||||
)
|
||||
|
||||
// WebhookRequest is a JSON request wrapper around all webhook messages.
|
||||
|
@ -188,9 +191,19 @@ func Profile() http.HandlerFunc {
|
|||
gender += fmt.Sprintf(" (%s)", pronouns)
|
||||
}
|
||||
|
||||
var photoCount = models.CountPublicPhotos(currentUser.ID)
|
||||
|
||||
var resp = Response{
|
||||
OK: true,
|
||||
ProfileFields: []ProfileField{
|
||||
{
|
||||
Name: "Member Since",
|
||||
Value: fmt.Sprintf("%s ago", utility.FormatDurationCoarse(time.Since(currentUser.CreatedAt))),
|
||||
},
|
||||
{
|
||||
Name: "📸 Gallery",
|
||||
Value: fmt.Sprintf("At least %d photo%s", photoCount, templates.Pluralize(photoCount)),
|
||||
},
|
||||
{
|
||||
Name: "Age",
|
||||
Value: currentUser.GetDisplayAge(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user