1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-03 00:45:22 +02:00

chore(models): rewrite code format. (#14754)

* chore: rewrite format.

* chore: update format

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: update format

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: Adjacent parameters with the same type should be grouped together

* chore: update format.
This commit is contained in:
Bo-Yi Wu 2021-03-15 02:52:12 +08:00 committed by GitHub
parent 164e35ead3
commit 167b0f46ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 474 additions and 460 deletions

View file

@ -267,7 +267,6 @@ func (c *Comment) AfterDelete() {
}
_, err := DeleteAttachmentsByComment(c.ID, true)
if err != nil {
log.Info("Could not delete files for comment %d on issue #%d: %s", c.ID, c.IssueID, err)
}
@ -391,7 +390,6 @@ func (c *Comment) LoadLabel() error {
// LoadProject if comment.Type is CommentTypeProject, then load project.
func (c *Comment) LoadProject() error {
if c.OldProjectID > 0 {
var oldProject Project
has, err := x.ID(c.OldProjectID).Get(&oldProject)
@ -813,7 +811,7 @@ func createDeadlineComment(e *xorm.Session, doer *User, issue *Issue, newDeadlin
return nil, err
}
var opts = &CreateCommentOptions{
opts := &CreateCommentOptions{
Type: commentType,
Doer: doer,
Repo: issue.Repo,
@ -828,7 +826,7 @@ func createDeadlineComment(e *xorm.Session, doer *User, issue *Issue, newDeadlin
}
// Creates issue dependency comment
func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dependentIssue *Issue, add bool) (err error) {
func createIssueDependencyComment(e *xorm.Session, doer *User, issue, dependentIssue *Issue, add bool) (err error) {
cType := CommentTypeAddDependency
if !add {
cType = CommentTypeRemoveDependency
@ -838,7 +836,7 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
}
// Make two comments, one in each issue
var opts = &CreateCommentOptions{
opts := &CreateCommentOptions{
Type: cType,
Doer: doer,
Repo: issue.Repo,
@ -977,7 +975,7 @@ type FindCommentsOptions struct {
}
func (opts *FindCommentsOptions) toConds() builder.Cond {
var cond = builder.NewCond()
cond := builder.NewCond()
if opts.RepoID > 0 {
cond = cond.And(builder.Eq{"issue.repo_id": opts.RepoID})
}
@ -1149,7 +1147,7 @@ func findCodeComments(e Engine, opts FindCommentsOptions, issue *Issue, currentU
// Find all reviews by ReviewID
reviews := make(map[int64]*Review)
var ids = make([]int64, 0, len(comments))
ids := make([]int64, 0, len(comments))
for _, comment := range comments {
if comment.ReviewID != 0 {
ids = append(ids, comment.ReviewID)