package api
// NotifyChatBridgeStopped tells one of a repository's admins that its
// Fossil chat bridge stopped itself because the other server kept
// refusing its login, and that it waits for them: a new credential or
// Resume on the settings page. It is sent once per stop (the caller
// speaks only on the transition into stopped), to each admin once; the
// key names the repository and the stop, so a later stop is its own
// news.
//
// It rides the landing family, as an import's ending does: work the
// person is answerable for that now wants their attention, with the
// push and inbox row that family already carries.
func (d Deps) NotifyChatBridgeStopped(repo, to, stopped, why string) {
if !personTo(to) {
return
}
d.fireNotify(NotifyEvent{
Workflow: "quarry-landing", To: to,
Payload: map[string]any{
"repo": repo, "from": "chat bridge", "surface": "chat bridge",
"summary": "The chat bridge on " + repo + " stopped: " + clipNote(why, 160),
"link": d.link("/r/" + repo + "/settings#chat-bridge"),
},
TxnID: "chatbridge-stopped:" + repo + ":" + stopped + ":" + to,
})
}