Skip to content

Commit ed7a7f0

Browse files
committed
Merge branch 'release/v1.25' into lunny/release_note_1.25.1
2 parents 383b607 + 8116742 commit ed7a7f0

File tree

7 files changed

+28
-12
lines changed

7 files changed

+28
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ require (
109109
github.com/ulikunitz/xz v0.5.15
110110
github.com/urfave/cli-docs/v3 v3.0.0-alpha6
111111
github.com/urfave/cli/v3 v3.4.1
112-
github.com/wneessen/go-mail v0.7.0
112+
github.com/wneessen/go-mail v0.7.2
113113
github.com/xeipuuv/gojsonschema v1.2.0
114114
github.com/yohcop/openid-go v1.0.1
115115
github.com/yuin/goldmark v1.7.13

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZ
768768
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
769769
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
770770
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
771-
github.com/wneessen/go-mail v0.7.0 h1:/Wmgd5AVjp5PA+Ken5EFfr+QR83gmqHli9HcAhh0vnU=
772-
github.com/wneessen/go-mail v0.7.0/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k=
771+
github.com/wneessen/go-mail v0.7.2 h1:xxPnhZ6IZLSgxShebmZ6DPKh1b6OJcoHfzy7UjOkzS8=
772+
github.com/wneessen/go-mail v0.7.2/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k=
773773
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
774774
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
775775
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=

models/pull/review_state.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ func init() {
4949
db.RegisterModel(new(ReviewState))
5050
}
5151

52+
func (rs *ReviewState) GetViewedFileCount() int {
53+
if len(rs.UpdatedFiles) == 0 {
54+
return 0
55+
}
56+
var numViewedFiles int
57+
for _, state := range rs.UpdatedFiles {
58+
if state == Viewed {
59+
numViewedFiles++
60+
}
61+
}
62+
return numViewedFiles
63+
}
64+
5265
// GetReviewState returns the ReviewState with all given values prefilled, whether or not it exists in the database.
5366
// If the review didn't exist before in the database, it won't afterwards either.
5467
// The returned boolean shows whether the review exists in the database

routers/web/repo/pull.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,12 +753,16 @@ func viewPullFiles(ctx *context.Context, beforeCommitID, afterCommitID string) {
753753
// as the viewed information is designed to be loaded only on latest PR
754754
// diff and if you're signed in.
755755
var reviewState *pull_model.ReviewState
756+
var numViewedFiles int
756757
if ctx.IsSigned && isShowAllCommits {
757758
reviewState, err = gitdiff.SyncUserSpecificDiff(ctx, ctx.Doer.ID, pull, gitRepo, diff, diffOptions)
758759
if err != nil {
759760
ctx.ServerError("SyncUserSpecificDiff", err)
760761
return
761762
}
763+
if reviewState != nil {
764+
numViewedFiles = reviewState.GetViewedFileCount()
765+
}
762766
}
763767

764768
diffShortStat, err := gitdiff.GetDiffShortStat(ctx.Repo.GitRepo, beforeCommitID, afterCommitID)
@@ -767,10 +771,11 @@ func viewPullFiles(ctx *context.Context, beforeCommitID, afterCommitID string) {
767771
return
768772
}
769773
ctx.Data["DiffShortStat"] = diffShortStat
774+
ctx.Data["NumViewedFiles"] = numViewedFiles
770775

771776
ctx.PageData["prReview"] = map[string]any{
772777
"numberOfFiles": diffShortStat.NumFiles,
773-
"numberOfViewedFiles": diff.NumViewedFiles,
778+
"numberOfViewedFiles": numViewedFiles,
774779
}
775780

776781
if err = diff.LoadComments(ctx, issue, ctx.Doer, ctx.Data["ShowOutdatedComments"].(bool)); err != nil {

services/gitdiff/gitdiff.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,9 @@ func getCommitFileLineCountAndLimitedContent(commit *git.Commit, filePath string
449449

450450
// Diff represents a difference between two git trees.
451451
type Diff struct {
452-
Start, End string
453-
Files []*DiffFile
454-
IsIncomplete bool
455-
NumViewedFiles int // user-specific
452+
Start, End string
453+
Files []*DiffFile
454+
IsIncomplete bool
456455
}
457456

458457
// LoadComments loads comments into each line
@@ -1342,7 +1341,6 @@ outer:
13421341
// Check whether the file has already been viewed
13431342
if fileViewedState == pull_model.Viewed {
13441343
diffFile.IsViewed = true
1345-
diff.NumViewedFiles++
13461344
}
13471345
}
13481346

services/mailer/sender/smtp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (s *SMTPSender) Send(from string, to []string, msg io.WriterTo) error {
128128
return fmt.Errorf("failed to issue MAIL command: %w", err)
129129
}
130130
} else {
131-
if err = client.Mail(from); err != nil {
131+
if err = client.Mail(fmt.Sprintf("<%s>", from)); err != nil {
132132
return fmt.Errorf("failed to issue MAIL command: %w", err)
133133
}
134134
}

templates/repo/diff/box.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
{{if and .PageIsPullFiles $.SignedUserID (not .DiffNotAvailable)}}
2828
<div class="not-mobile tw-flex tw-items-center tw-flex-col tw-whitespace-nowrap tw-mr-1">
2929
<label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{ctx.Locale.Tr "repo.pulls.viewed_files_label"}}">
30-
{{ctx.Locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .DiffShortStat.NumFiles}}
30+
{{ctx.Locale.Tr "repo.pulls.viewed_files_label" .NumViewedFiles .DiffShortStat.NumFiles}}
3131
</label>
32-
<progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.DiffShortStat.NumFiles}}"></progress>
32+
<progress id="viewed-files-summary" value="{{.NumViewedFiles}}" max="{{.DiffShortStat.NumFiles}}"></progress>
3333
</div>
3434
{{end}}
3535
{{template "repo/diff/whitespace_dropdown" .}}

0 commit comments

Comments
 (0)