Browse Source

migration

pull/946/head
Alexey Makhov 10 years ago
parent
commit
7227a523be
  1. 25
      models/migrations/migrations.go
  2. 2
      modules/base/markdown.go
  3. 2
      templates/repo/diff.tmpl

25
models/migrations/migrations.go

@ -2,7 +2,6 @@ package migrations
import ( import (
"errors" "errors"
"time"
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
) )
@ -56,22 +55,22 @@ func expiredMigration(x *xorm.Engine) error {
} }
func prepareToCommitComments(x *xorm.Engine) error { func prepareToCommitComments(x *xorm.Engine) error {
type Comment struct {
Id int64
Type int64
PosterId int64
IssueId int64
CommitId string
Line string
Content string `xorm:"TEXT"`
Created time.Time `xorm:"CREATED"`
}
x.Sync(new(Comment))
sql := `UPDATE comment SET commit_id = '', line = '' WHERE commit_id = '0' AND line = '0'` sql := `ALTER TABLE comment MODIFY commit_id VARCHAR(50) DEFAULT NULL`
_, err := x.Exec(sql) _, err := x.Exec(sql)
if err != nil { if err != nil {
return err return err
} }
sql = `ALTER TABLE comment MODIFY line VARCHAR(50) DEFAULT NULL;`
_, err = x.Exec(sql)
if err != nil {
return err
}
sql = `UPDATE comment SET commit_id = '', line = '' WHERE commit_id = '0' AND line = '0'`
_, err = x.Exec(sql)
if err != nil {
return err
}
return nil return nil
} }

2
modules/base/markdown.go

@ -129,7 +129,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
ms := MentionPattern.FindAll(line, -1) ms := MentionPattern.FindAll(line, -1)
for _, m := range ms { for _, m := range ms {
line = bytes.Replace(line, m, line = bytes.Replace(line, m,
[]byte(fmt.Sprintf(`<a href="%s/user/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1) []byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
} }
} }

2
templates/repo/diff.tmpl

@ -131,7 +131,7 @@
<p class="panel-header clear"><a class="author-name" href="{{AppSubUrl}}/{{.Poster.Name}}">{{.Poster.Name}}</a> <p class="panel-header clear"><a class="author-name" href="{{AppSubUrl}}/{{.Poster.Name}}">{{.Poster.Name}}</a>
<span class="date">{{TimeSince .Created $.Lang}}</span> <span class="date">{{TimeSince .Created $.Lang}}</span>
<span class="action right"> <span class="action right">
{{if $.IsRepositoryOwner}} {{if eq $.Repository.Owner.Id .Poster.Id}}
<span class="label label-black label-radius">{{$.i18n.Tr "repo.owner"}}</span> <span class="label label-black label-radius">{{$.i18n.Tr "repo.owner"}}</span>
{{end}} {{end}}
<!--<a href="#"><i class="octicon octicon-pencil"></i></a>--> <!--<a href="#"><i class="octicon octicon-pencil"></i></a>-->

Loading…
Cancel
Save