diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 7bc291d2f..77f2ab053 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -2,7 +2,6 @@ package migrations import ( "errors" - "time" "github.com/go-xorm/xorm" ) @@ -56,22 +55,22 @@ func expiredMigration(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) if err != nil { 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 } diff --git a/modules/base/markdown.go b/modules/base/markdown.go index d3f3e5fea..79871e45e 100644 --- a/modules/base/markdown.go +++ b/modules/base/markdown.go @@ -129,7 +129,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte { ms := MentionPattern.FindAll(line, -1) for _, m := range ms { line = bytes.Replace(line, m, - []byte(fmt.Sprintf(`%s`, setting.AppSubUrl, m[1:], m)), -1) + []byte(fmt.Sprintf(`%s`, setting.AppSubUrl, m[1:], m)), -1) } } diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 100e67d4b..737905cee 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -131,7 +131,7 @@

{{.Poster.Name}} {{TimeSince .Created $.Lang}} - {{if $.IsRepositoryOwner}} + {{if eq $.Repository.Owner.Id .Poster.Id}} {{$.i18n.Tr "repo.owner"}} {{end}}