( ctx context.Context, req *api.PerformInviteRequest, res *api.PerformInviteResponse, )
| 202 | } |
| 203 | |
| 204 | func (r *RoomserverInternalAPI) PerformInvite( |
| 205 | ctx context.Context, |
| 206 | req *api.PerformInviteRequest, |
| 207 | res *api.PerformInviteResponse, |
| 208 | ) error { |
| 209 | outputEvents, err := r.Inviter.PerformInvite(ctx, req, res) |
| 210 | if err != nil { |
| 211 | sentry.CaptureException(err) |
| 212 | return err |
| 213 | } |
| 214 | if len(outputEvents) == 0 { |
| 215 | return nil |
| 216 | } |
| 217 | res1 := r.OutputProducer.ProduceRoomEvents(req.Event.RoomID(), outputEvents) |
| 218 | |
| 219 | |
| 220 | reveiverId := req.Event.StateKey() |
| 221 | senderId := req.Event.Sender() |
| 222 | auto := false |
| 223 | |
| 224 | auto, err = r.UserAPI.JudgeShouldAutoJoin(ctx, senderId, *reveiverId) |
| 225 | if err != nil { |
| 226 | sentry.CaptureException(err) |
| 227 | auto = false |
| 228 | } |
| 229 | |
| 230 | if auto { |
| 231 | go func() { |
| 232 | time.Sleep(time.Second * 2) |
| 233 | joinReq := api.PerformJoinRequest{ |
| 234 | RoomIDOrAlias: req.Event.RoomID(), |
| 235 | UserID: *reveiverId, |
| 236 | } |
| 237 | joinRes := api.PerformJoinResponse{} |
| 238 | r.Joiner.PerformJoin(ctx, &joinReq, &joinRes) |
| 239 | }() |
| 240 | } |
| 241 | // end |
| 242 | return res1 |
| 243 | } |
| 244 | |
| 245 | func (r *RoomserverInternalAPI) PerformLeave( |
| 246 | ctx context.Context, |
nothing calls this directly
no test coverage detected