dmitri.shuralyov.com/service/change

Work on better display of review event+comment.
dmitshur committed 6 years ago commit 2c0fdaf59eac125b1269279405baf69497c4677a
Showing partial commit. Full Commit
Collapse all
timeline.go
@@ -6,11 +6,11 @@ import (
	"github.com/shurcooL/issues"
	"github.com/shurcooL/reactions"
	"github.com/shurcooL/users"
)

// Comment represents a comment left on an issue.
// Comment represents a comment left on a change.
type Comment struct {
	ID        uint64
	User      users.User
	CreatedAt time.Time
	Edited    *Edited // Edited is nil if the comment hasn't been edited.
@@ -23,10 +23,29 @@ type Comment struct {
type Edited struct {
	By users.User
	At time.Time
}

type Review struct {
	ID        uint64
	User      users.User
	CreatedAt time.Time
	Edited    *Edited // Edited is nil if the review hasn't been edited.
	State     ReviewState
	Body      string // Optional.
	Reactions []reactions.Reaction
	Editable  bool // Editable represents whether the current user (if any) can perform edit operations on this review.
}

type ReviewState int8

const (
	Approved         ReviewState = +1
	Commented        ReviewState = 0
	ChangesRequested ReviewState = -1
)

// TimelineItem represents a timeline item.
type TimelineItem struct {
	ID        uint64 // TODO: See if this belongs here.
	Actor     users.User
	CreatedAt time.Time