( ctx context.Context, chatID uuid.UUID, action string, kind codersdk.ChatWatchEventKind, transition func(context.Context, uuid.UUID) ([]database.Chat, error), )
| 2342 | } |
| 2343 | |
| 2344 | func (p *Server) applyChatLifecycleTransition( |
| 2345 | ctx context.Context, |
| 2346 | chatID uuid.UUID, |
| 2347 | action string, |
| 2348 | kind codersdk.ChatWatchEventKind, |
| 2349 | transition func(context.Context, uuid.UUID) ([]database.Chat, error), |
| 2350 | ) error { |
| 2351 | updatedChats, err := transition(ctx, chatID) |
| 2352 | if err != nil { |
| 2353 | return xerrors.Errorf("%s chat: %w", action, err) |
| 2354 | } |
| 2355 | |
| 2356 | p.publishChatPubsubEvents(updatedChats, kind) |
| 2357 | return nil |
| 2358 | } |
| 2359 | |
| 2360 | // DeleteQueued removes a queued user message and publishes the queue update. |
| 2361 | func (p *Server) DeleteQueued( |
no test coverage detected