feat: add im home and message action flows

This commit is contained in:
richjohnrambo
2026-08-12 10:36:41 +08:00
parent d239e37f56
commit 5bd35f97a6
21 changed files with 3087 additions and 61 deletions
+21
View File
@@ -338,6 +338,27 @@ func TestDispatchLoginRejectsAuthenticatorTenantMismatch(t *testing.T) {
}
}
func TestPublishSysRequiresRoot(t *testing.T) {
s := &Session{
send: make(chan any, 1),
uid: types.Uid(42),
authLvl: auth.LevelAuth,
tenantID: 1,
tenantCode: "test",
}
s.publish(&ClientComMessage{
Original: "sys",
RcptTo: "sys",
AsUser: types.Uid(42).UserId(),
Timestamp: time.Now(),
Pub: &MsgClientPub{Id: "pub-1", Topic: "sys", Content: map[string]any{"type": "system"}},
})
resp := (<-s.send).(*ServerComMessage)
if resp.Ctrl == nil || resp.Ctrl.Code != http.StatusForbidden {
t.Fatalf("unexpected response: %+v", resp)
}
}
func TestDispatchRejectsCrossTenantAsUser(t *testing.T) {
ctrl := gomock.NewController(t)
users := mock_store.NewMockUsersPersistenceInterface(ctrl)