Sync profile source and message topic seq

This commit is contained in:
richjohnrambo
2026-09-04 16:06:57 +08:00
parent 47649d33e2
commit 7fb1ea70bc
5 changed files with 216 additions and 23 deletions
+17 -2
View File
@@ -52,7 +52,22 @@ func TestProfilePublicFromFields(t *testing.T) {
"avatar_file_id": "old_avatar",
"public_account": "usrAccount",
}, sql.NullString{Valid: true}, sql.NullString{Valid: true}).(map[string]any)
if public["fn"] != "旧昵称" || public["avatar_file_id"] != "old_avatar" || public["public_account"] != "usrAccount" {
t.Fatalf("empty profile fields should keep existing public values: %#v", public)
for _, key := range []string{"fn", "name", "nickname", "display_name", "avatar_file_id", "photo", "avatar"} {
if _, ok := public[key]; ok {
t.Fatalf("legacy profile field %s should not be read from im_users.public: %#v", key, public)
}
}
if public["public_account"] != "usrAccount" {
t.Fatalf("unrelated public field changed: %#v", public)
}
}
func TestProfileSeedFromPublic(t *testing.T) {
nickname, avatar := profileSeedFromPublic(map[string]any{
"fn": "旧昵称",
"photo": "file_avatar_1",
})
if nickname != "旧昵称" || avatar != "file_avatar_1" {
t.Fatalf("unexpected profile seed nickname=%q avatar=%q", nickname, avatar)
}
}