1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Implement Review form

Show Review comments on comment stream

Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
Jonas Franz
2018-05-11 12:50:44 +02:00
parent e252d3bdb5
commit 3e5f3c349e
11 changed files with 179 additions and 14 deletions

View File

@@ -27,6 +27,21 @@ const (
ReviewTypeReject
)
// Icon returns the corresponding icon for the review type
func (rt ReviewType) Icon() string {
switch rt {
case ReviewTypeApprove:
return "eye"
case ReviewTypeReject:
return "x"
default:
case ReviewTypeComment:
case ReviewTypeUnknown:
return "comment"
}
return "comment"
}
// Review represents collection of code comments giving feedback for a PR
type Review struct {
ID int64 `xorm:"pk autoincr"`
@@ -177,3 +192,11 @@ func getCurrentReview(e Engine, reviewer *User, issue *Issue) (*Review, error) {
func GetCurrentReview(reviewer *User, issue *Issue) (*Review, error) {
return getCurrentReview(x, reviewer, issue)
}
// UpdateReview will update all cols of the given review in db
func UpdateReview(r *Review) error {
if _, err := x.ID(r.ID).AllCols().Update(r); err != nil {
return err
}
return nil
}