mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-25 20:15:37 +02:00
fix(github): address review — null actor, role gating, configured guard, scoped uninstall broadcast
- listeners: use optionalUUID(e.ActorID) so the system actor on the github-driven issue:updated event no longer panics activity / notification listeners; merged-PR → issue done now produces a status_changed activity and inbox entry. - IntegrationsTab: gate the admin-only installations query on canManage so members no longer hit /github/installations 403; the configured/not-configured copy is also scoped to admins. - backend: introduce isGitHubConfigured() requiring both GITHUB_APP_SLUG and GITHUB_WEBHOOK_SECRET, and surface that single flag from list-installations + connect endpoints so the frontend Connect button stays disabled until both are set. - DeleteGitHubInstallationByInstallationID now RETURNs workspace_id; webhook handler publishes github_installation:deleted scoped to the right workspace so already-open Settings tabs invalidate in real time. ErrNoRows on a re-fired delete short-circuits cleanly. - tests: focused webhook integration coverage (auto-link + merge → done, cancelled preservation, uninstall returns workspace). Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -74,13 +74,21 @@ func (q *Queries) DeleteGitHubInstallation(ctx context.Context, arg DeleteGitHub
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteGitHubInstallationByInstallationID = `-- name: DeleteGitHubInstallationByInstallationID :exec
|
||||
const deleteGitHubInstallationByInstallationID = `-- name: DeleteGitHubInstallationByInstallationID :one
|
||||
DELETE FROM github_installation WHERE installation_id = $1
|
||||
RETURNING id, workspace_id
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteGitHubInstallationByInstallationID(ctx context.Context, installationID int64) error {
|
||||
_, err := q.db.Exec(ctx, deleteGitHubInstallationByInstallationID, installationID)
|
||||
return err
|
||||
type DeleteGitHubInstallationByInstallationIDRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) DeleteGitHubInstallationByInstallationID(ctx context.Context, installationID int64) (DeleteGitHubInstallationByInstallationIDRow, error) {
|
||||
row := q.db.QueryRow(ctx, deleteGitHubInstallationByInstallationID, installationID)
|
||||
var i DeleteGitHubInstallationByInstallationIDRow
|
||||
err := row.Scan(&i.ID, &i.WorkspaceID)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getGitHubInstallationByID = `-- name: GetGitHubInstallationByID :one
|
||||
|
||||
Reference in New Issue
Block a user