MCPcopy Create free account
hub / github.com/daodst/chat / ValidateCreateRoomReq

Function ValidateCreateRoomReq

clientapi/routing/createroom.go:170–178  ·  view source on GitHub ↗
(ctx context.Context, r createRoomRequest, device *api.Device, profileAPI api.ClientUserAPI)

Source from the content-addressed store, hash-verified

168}
169
170func ValidateCreateRoomReq(ctx context.Context, r createRoomRequest, device *api.Device, profileAPI api.ClientUserAPI) error {
171 for _, invitee := range r.Invite {
172 autoJoin, err := profileAPI.JudgeShouldAutoJoin(ctx, device.UserID, invitee)
173 if err != nil || !autoJoin {
174 return errors.New("user " + invitee + " can not be invited")
175 }
176 }
177 return nil
178}
179
180// createRoom implements /createRoom
181// nolint: gocyclo

Callers 1

CreateRoomFunction · 0.85

Calls 1

JudgeShouldAutoJoinMethod · 0.65

Tested by

no test coverage detected