Add 'Reply' as translatable
Add CODE_COMMENT_LINES setting Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
parent
9a0c3947e0
commit
c8c1e704ed
|
|
@ -67,6 +67,8 @@ EXPLORE_PAGING_NUM = 20
|
||||||
ISSUE_PAGING_NUM = 10
|
ISSUE_PAGING_NUM = 10
|
||||||
; Number of maximum commits displayed in one activity feed
|
; Number of maximum commits displayed in one activity feed
|
||||||
FEED_MAX_COMMIT_NUM = 5
|
FEED_MAX_COMMIT_NUM = 5
|
||||||
|
; Number of line of codes shown for a code comment
|
||||||
|
CODE_COMMENT_LINES = 4
|
||||||
; Value of `theme-color` meta tag, used by Android >= 5.0
|
; Value of `theme-color` meta tag, used by Android >= 5.0
|
||||||
; An invalid color like "none" or "disable" will have the default style
|
; An invalid color like "none" or "disable" will have the default style
|
||||||
; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
|
; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ func (c *Comment) AsDiff() (*Diff, error) {
|
||||||
if len(diff.Files) == 0 {
|
if len(diff.Files) == 0 {
|
||||||
return nil, fmt.Errorf("no file found for comment ID: %d", c.ID)
|
return nil, fmt.Errorf("no file found for comment ID: %d", c.ID)
|
||||||
}
|
}
|
||||||
// Limit to 4 lines around comment line
|
// Limit to CODE_COMMENT_LINES lines around comment line
|
||||||
for _, sec := range diff.Files[0].Sections {
|
for _, sec := range diff.Files[0].Sections {
|
||||||
var searchedLineIdx int
|
var searchedLineIdx int
|
||||||
for lineIdx, line := range sec.Lines {
|
for lineIdx, line := range sec.Lines {
|
||||||
|
|
@ -409,9 +409,9 @@ func (c *Comment) AsDiff() (*Diff, error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if searchedLineIdx >= 3 {
|
if searchedLineIdx >= setting.UI.CodeCommentLines - 1 {
|
||||||
first := searchedLineIdx-3
|
first := searchedLineIdx - setting.UI.CodeCommentLines + 1
|
||||||
last := searchedLineIdx+1
|
last := searchedLineIdx + 1
|
||||||
sec.Lines = sec.Lines[first:last]
|
sec.Lines = sec.Lines[first:last]
|
||||||
diff.Files[0].Sections = []*DiffSection{sec}
|
diff.Files[0].Sections = []*DiffSection{sec}
|
||||||
break
|
break
|
||||||
|
|
@ -428,11 +428,12 @@ func (c *Comment) AsDiff() (*Diff, error) {
|
||||||
func (c *Comment) MustAsDiff() *Diff {
|
func (c *Comment) MustAsDiff() *Diff {
|
||||||
diff, err := c.AsDiff()
|
diff, err := c.AsDiff()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn( "MustAsDiff: %v", err)
|
log.Warn("MustAsDiff: %v", err)
|
||||||
}
|
}
|
||||||
return diff
|
return diff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CodeCommentURL returns the url to a comment in code
|
||||||
func (c *Comment) CodeCommentURL() string {
|
func (c *Comment) CodeCommentURL() string {
|
||||||
err := c.LoadIssue()
|
err := c.LoadIssue()
|
||||||
if err != nil { // Silently dropping errors :unamused:
|
if err != nil { // Silently dropping errors :unamused:
|
||||||
|
|
@ -465,7 +466,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
|
||||||
NewTitle: opts.NewTitle,
|
NewTitle: opts.NewTitle,
|
||||||
TreePath: opts.TreePath,
|
TreePath: opts.TreePath,
|
||||||
ReviewID: opts.ReviewID,
|
ReviewID: opts.ReviewID,
|
||||||
Patch: opts.Patch,
|
Patch: opts.Patch,
|
||||||
}
|
}
|
||||||
if _, err = e.Insert(comment); err != nil {
|
if _, err = e.Insert(comment); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -683,7 +684,7 @@ type CreateCommentOptions struct {
|
||||||
NewTitle string
|
NewTitle string
|
||||||
CommitID int64
|
CommitID int64
|
||||||
CommitSHA string
|
CommitSHA string
|
||||||
Patch string
|
Patch string
|
||||||
LineNum int64
|
LineNum int64
|
||||||
TreePath string
|
TreePath string
|
||||||
ReviewID int64
|
ReviewID int64
|
||||||
|
|
@ -786,7 +787,7 @@ func CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, tree
|
||||||
TreePath: treePath,
|
TreePath: treePath,
|
||||||
CommitSHA: commit.ID.String(),
|
CommitSHA: commit.ID.String(),
|
||||||
ReviewID: reviewID,
|
ReviewID: reviewID,
|
||||||
Patch: patchBuf.String(),
|
Patch: patchBuf.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@ var (
|
||||||
IssuePagingNum int
|
IssuePagingNum int
|
||||||
RepoSearchPagingNum int
|
RepoSearchPagingNum int
|
||||||
FeedMaxCommitNum int
|
FeedMaxCommitNum int
|
||||||
|
CodeCommentLines int
|
||||||
ReactionMaxUserNum int
|
ReactionMaxUserNum int
|
||||||
ThemeColorMetaTag string
|
ThemeColorMetaTag string
|
||||||
MaxDisplayFileSize int64
|
MaxDisplayFileSize int64
|
||||||
|
|
@ -294,6 +295,7 @@ var (
|
||||||
IssuePagingNum: 10,
|
IssuePagingNum: 10,
|
||||||
RepoSearchPagingNum: 10,
|
RepoSearchPagingNum: 10,
|
||||||
FeedMaxCommitNum: 5,
|
FeedMaxCommitNum: 5,
|
||||||
|
CodeCommentLines: 4,
|
||||||
ReactionMaxUserNum: 10,
|
ReactionMaxUserNum: 10,
|
||||||
ThemeColorMetaTag: `#6cc644`,
|
ThemeColorMetaTag: `#6cc644`,
|
||||||
MaxDisplayFileSize: 8388608,
|
MaxDisplayFileSize: 8388608,
|
||||||
|
|
|
||||||
|
|
@ -1126,6 +1126,7 @@ diff.comment.markdown_info = Styling with markdown is supported.
|
||||||
diff.comment.add_single_comment = Add single comment
|
diff.comment.add_single_comment = Add single comment
|
||||||
diff.comment.add_review_comment = Add comment
|
diff.comment.add_review_comment = Add comment
|
||||||
diff.comment.start_review = Start review
|
diff.comment.start_review = Start review
|
||||||
|
diff.comment.reply = Reply
|
||||||
diff.review = Review
|
diff.review = Review
|
||||||
diff.review.header = Submit review
|
diff.review.header = Submit review
|
||||||
diff.review.placeholder = Review comment
|
diff.review.placeholder = Review comment
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{{if $.root.SignedUserID}}
|
{{if $.root.SignedUserID}}
|
||||||
{{if $.hidden}}
|
{{if $.hidden}}
|
||||||
<button class="comment-form-reply ui green labeled icon tiny button"><i class="reply icon"></i> Reply</button>
|
<button class="comment-form-reply ui green labeled icon tiny button"><i class="reply icon"></i> {{$.root.i18n.Tr "repo.diff.comment.reply"}}</button>
|
||||||
{{end}}
|
{{end}}
|
||||||
<form class="ui form {{if $.hidden}}hide comment-form{{end}}" action="{{$.root.Issue.HTMLURL}}/files/reviews/comments" method="post">
|
<form class="ui form {{if $.hidden}}hide comment-form{{end}}" action="{{$.root.Issue.HTMLURL}}/files/reviews/comments" method="post">
|
||||||
{{$.root.CsrfTokenHtml}}
|
{{$.root.CsrfTokenHtml}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user