aboutsummaryrefslogtreecommitdiffstats
path: root/models/review.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/review.go')
-rw-r--r--models/review.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/models/review.go b/models/review.go
index 88d0819089..8b0092b1ed 100644
--- a/models/review.go
+++ b/models/review.go
@@ -86,7 +86,8 @@ func init() {
db.RegisterModel(new(Review))
}
-func (r *Review) loadCodeComments(ctx context.Context) (err error) {
+// LoadCodeComments loads CodeComments
+func (r *Review) LoadCodeComments(ctx context.Context) (err error) {
if r.CodeComments != nil {
return
}
@@ -97,11 +98,6 @@ func (r *Review) loadCodeComments(ctx context.Context) (err error) {
return
}
-// LoadCodeComments loads CodeComments
-func (r *Review) LoadCodeComments() error {
- return r.loadCodeComments(db.DefaultContext)
-}
-
func (r *Review) loadIssue(e db.Engine) (err error) {
if r.Issue != nil {
return
@@ -137,12 +133,13 @@ func (r *Review) LoadReviewerTeam() error {
return r.loadReviewerTeam(db.GetEngine(db.DefaultContext))
}
-func (r *Review) loadAttributes(ctx context.Context) (err error) {
+// LoadAttributes loads all attributes except CodeComments
+func (r *Review) LoadAttributes(ctx context.Context) (err error) {
e := db.GetEngine(ctx)
if err = r.loadIssue(e); err != nil {
return
}
- if err = r.loadCodeComments(ctx); err != nil {
+ if err = r.LoadCodeComments(ctx); err != nil {
return
}
if err = r.loadReviewer(e); err != nil {
@@ -154,11 +151,6 @@ func (r *Review) loadAttributes(ctx context.Context) (err error) {
return
}
-// LoadAttributes loads all attributes except CodeComments
-func (r *Review) LoadAttributes() error {
- return r.loadAttributes(db.DefaultContext)
-}
-
func getReviewByID(e db.Engine, id int64) (*Review, error) {
review := new(Review)
if has, err := e.ID(id).Get(review); err != nil {
@@ -405,7 +397,7 @@ func SubmitReview(doer *user_model.User, issue *Issue, reviewType ReviewType, co
return nil, nil, err
}
} else {
- if err := review.loadCodeComments(ctx); err != nil {
+ if err := review.LoadCodeComments(ctx); err != nil {
return nil, nil, err
}
if reviewType != ReviewTypeApprove && len(review.CodeComments) == 0 && len(strings.TrimSpace(content)) == 0 {