diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2023-04-03 20:19:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 20:19:26 +0200 |
commit | c2db38d2954b8d5d1944b64671985d5ffd3b5c28 (patch) | |
tree | 7199fa013869cd7298562d75f6e94f8321da8a15 /internal | |
parent | 4cb9cd7842e58b542b25a2e9d7cdb7f61d147e96 (diff) |
Add user profile tests, refactor user API methods (#3030)
This adds tests for `/profile`.
Also, as a first change in this regard, refactors the methods defined on
the `UserInternalAPI` to not use structs as the request/response
parameters.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/eventutil/types.go | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/internal/eventutil/types.go b/internal/eventutil/types.go index 18175d6a..e43c0412 100644 --- a/internal/eventutil/types.go +++ b/internal/eventutil/types.go @@ -15,16 +15,11 @@ package eventutil import ( - "errors" "strconv" "github.com/matrix-org/dendrite/syncapi/types" ) -// ErrProfileNoExists is returned when trying to lookup a user's profile that -// doesn't exist locally. -var ErrProfileNoExists = errors.New("no known profile for given user ID") - // AccountData represents account data sent from the client API server to the // sync API server type AccountData struct { @@ -56,20 +51,10 @@ type NotificationData struct { UnreadNotificationCount int `json:"unread_notification_count"` } -// ProfileResponse is a struct containing all known user profile data -type ProfileResponse struct { - AvatarURL string `json:"avatar_url"` - DisplayName string `json:"displayname"` -} - -// AvatarURL is a struct containing only the URL to a user's avatar -type AvatarURL struct { - AvatarURL string `json:"avatar_url"` -} - -// DisplayName is a struct containing only a user's display name -type DisplayName struct { - DisplayName string `json:"displayname"` +// UserProfile is a struct containing all known user profile data +type UserProfile struct { + AvatarURL string `json:"avatar_url,omitempty"` + DisplayName string `json:"displayname,omitempty"` } // WeakBoolean is a type that will Unmarshal to true or false even if the encoded |