Documentation
¶
Overview ¶
Package startreview turns a verified "Start review" button click into a recorded review plus an in-place update of the PR's Slack message.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler consumes a parsed Slack interaction and, for a "start_review" click, records the click's user as a reviewer and appends a marker line to the PR message. Multiple distinct users may review the same PR; a user clicking again is a no-op (guarded in the app and enforced by the DB unique index).
func NewHandler ¶
func NewHandler(reviews Reviews, messages Messages, slackUpdater SlackUpdater, composer Composer, logger *slog.Logger, now func() time.Time) *Handler
NewHandler builds a Handler. now is injected for deterministic tests.
type Messages ¶
type Messages interface {
Messages(ctx context.Context, repository string, prNumber int) ([]store.Message, error)
}
Messages confirms notifycat owns a message for the PR before acting on a click.
type Reviews ¶
type Reviews interface {
ActiveForUser(ctx context.Context, repository string, prNumber int, slackUserID string) (store.CodeReview, error)
Start(ctx context.Context, repository string, prNumber int, slackUserID, slackUserName string) error
}
Reviews records and inspects per-PR review sessions.
type SlackUpdater ¶
type SlackUpdater interface {
UpdateMessageRawBlocks(ctx context.Context, channel, ts string, blocks []json.RawMessage, fallback string) error
}
SlackUpdater edits the PR message in place, passing the original blocks through untouched with the reviewer marker appended.