diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-10-21 10:48:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 10:48:25 +0200 |
commit | e57b30172227c4a0b7de15ba635b20921dedda5e (patch) | |
tree | fa73a898b6a58d2250e2e7c6fd7b7f5df8b0f7f2 /userapi/userapi_test.go | |
parent | 40cfb9a4ea23f1c9214553255feb296c2578b213 (diff) |
Set `display_name` and/or `avatar_url` for server notices (#2820)
This should fix #2815 by making sure we actually set the `display_name`
and/or `avatar_url` and create the needed membership event.
To avoid creating a new membership event when starting Dendrite,
`SetAvatarURL` and `SetDisplayName` now return a `Changed` value, which
also makes the regular endpoints idempotent.
Diffstat (limited to 'userapi/userapi_test.go')
-rw-r--r-- | userapi/userapi_test.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/userapi/userapi_test.go b/userapi/userapi_test.go index 4417f4dc..aaa93f45 100644 --- a/userapi/userapi_test.go +++ b/userapi/userapi_test.go @@ -23,13 +23,14 @@ import ( "time" "github.com/gorilla/mux" + "github.com/matrix-org/gomatrixserverlib" + "golang.org/x/crypto/bcrypt" + "github.com/matrix-org/dendrite/internal/httputil" "github.com/matrix-org/dendrite/test" "github.com/matrix-org/dendrite/test/testrig" "github.com/matrix-org/dendrite/userapi" "github.com/matrix-org/dendrite/userapi/inthttp" - "github.com/matrix-org/gomatrixserverlib" - "golang.org/x/crypto/bcrypt" "github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/userapi/api" @@ -83,10 +84,10 @@ func TestQueryProfile(t *testing.T) { if err != nil { t.Fatalf("failed to make account: %s", err) } - if err := accountDB.SetAvatarURL(context.TODO(), "alice", aliceAvatarURL); err != nil { + if _, _, err := accountDB.SetAvatarURL(context.TODO(), "alice", aliceAvatarURL); err != nil { t.Fatalf("failed to set avatar url: %s", err) } - if err := accountDB.SetDisplayName(context.TODO(), "alice", aliceDisplayName); err != nil { + if _, _, err := accountDB.SetDisplayName(context.TODO(), "alice", aliceDisplayName); err != nil { t.Fatalf("failed to set display name: %s", err) } |