Feat v0.6.15 user display audit
Some checks failed
CI/CD / detect-changes (pull_request) Successful in 3s
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / build-and-deploy (pull_request) Has been cancelled
CI/CD / test-go-pg (pull_request) Has been cancelled
CI/CD / test-sqlite (pull_request) Has been cancelled
Some checks failed
CI/CD / detect-changes (pull_request) Successful in 3s
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / build-and-deploy (pull_request) Has been cancelled
CI/CD / test-go-pg (pull_request) Has been cancelled
CI/CD / test-sqlite (pull_request) Has been cancelled
Add batch user resolve endpoint, sw.users SDK module, and migrate all surfaces to show display_name instead of UUIDs. Canonical fallback chain: display_name → username → "Unknown". - GET /api/v1/users/resolve?ids=... (max 100, map response) - sw.users.resolve(), resolveMany(), displayName() with 60s cache - Chat participants resolved from users table, not snapshot - Admin users/teams/groups/team-admin show display_name - Chat-core participants.display_name column deprecated - 5 new handler tests, OpenAPI spec updated Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -81,3 +81,38 @@ func (h *PresenceHandler) SearchUsers(c *gin.Context) {
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"data": results})
|
||||
}
|
||||
|
||||
// ResolveUsers returns identity records for a batch of user IDs.
|
||||
// GET /api/v1/users/resolve?ids=uuid1,uuid2,...
|
||||
func (h *PresenceHandler) ResolveUsers(c *gin.Context) {
|
||||
raw := strings.TrimSpace(c.Query("ids"))
|
||||
if raw == "" {
|
||||
c.JSON(http.StatusOK, gin.H{"data": map[string]interface{}{}})
|
||||
return
|
||||
}
|
||||
|
||||
ids := make([]string, 0)
|
||||
for _, id := range strings.Split(raw, ",") {
|
||||
id = strings.TrimSpace(id)
|
||||
if id != "" {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
c.JSON(http.StatusOK, gin.H{"data": map[string]interface{}{}})
|
||||
return
|
||||
}
|
||||
|
||||
results, err := h.stores.Users.ResolveByIDs(c.Request.Context(), ids)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "resolve failed"})
|
||||
return
|
||||
}
|
||||
|
||||
// Build map keyed by user ID for O(1) client-side lookups
|
||||
m := make(map[string]interface{}, len(results))
|
||||
for _, u := range results {
|
||||
m[u.ID] = u
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"data": m})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user