Skip to content

Commit 0614610

Browse files
committed
add contexts
1 parent ff70703 commit 0614610

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

models/activities/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func (n *Notification) HTMLURL(ctx context.Context) string {
358358
case NotificationSourceRepository:
359359
return n.Repository.HTMLURL(ctx)
360360
case NotificationSourceRelease:
361-
return n.Release.HTMLURL()
361+
return n.Release.HTMLURL(ctx)
362362
}
363363
return ""
364364
}

models/repo/release.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ func (r *Release) TarURL() string {
140140
}
141141

142142
// HTMLURL the url for a release on the web UI. release must have attributes loaded
143-
func (r *Release) HTMLURL() string {
144-
return r.Repo.HTMLURL() + "/releases/tag/" + util.PathEscapeSegments(r.TagName)
143+
func (r *Release) HTMLURL(ctx context.Context) string {
144+
return r.Repo.HTMLURL(ctx) + "/releases/tag/" + util.PathEscapeSegments(r.TagName)
145145
}
146146

147147
// APIUploadURL the api url to upload assets to a release. release must have attributes loaded

routers/web/feed/convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func releasesToFeedItems(ctx *context.Context, releases []*repo_model.Release) (
289289
title = rel.Title
290290
}
291291

292-
link := &feeds.Link{Href: rel.HTMLURL()}
292+
link := &feeds.Link{Href: rel.HTMLURL(ctx)}
293293
rctx := renderhelper.NewRenderContextRepoComment(ctx, rel.Repo).WithUseAbsoluteLink(true)
294294
content, err = markdown.RenderString(rctx,
295295
rel.Note)

services/convert/notification.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification)
6969
}
7070
}
7171
case activities_model.NotificationSourceCommit:
72-
url := n.Repository.HTMLURL() + "/commit/" + url.PathEscape(n.CommitID)
72+
url := n.Repository.HTMLURL(ctx) + "/commit/" + url.PathEscape(n.CommitID)
7373
title, _ := git.SplitCommitTitleBody(n.Commit.CommitMessage, 255)
7474
result.Subject = &api.NotificationSubject{
7575
Type: api.NotifySubjectCommit,
@@ -83,14 +83,14 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification)
8383
Title: n.Repository.FullName(),
8484
// FIXME: this is a relative URL, rather useless and inconsistent, but keeping for backwards compat
8585
URL: n.Repository.Link(),
86-
HTMLURL: n.Repository.HTMLURL(),
86+
HTMLURL: n.Repository.HTMLURL(ctx),
8787
}
8888
case activities_model.NotificationSourceRelease:
8989
result.Subject = &api.NotificationSubject{
9090
Type: api.NotifySubjectRelease,
9191
Title: n.Release.Title,
9292
URL: n.Release.Link(),
93-
HTMLURL: n.Release.HTMLURL(),
93+
HTMLURL: n.Release.HTMLURL(ctx),
9494
}
9595
}
9696

services/convert/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func ToAPIRelease(ctx context.Context, repo *repo_model.Repository, r *repo_mode
1919
Title: r.Title,
2020
Note: r.Note,
2121
URL: r.APIURL(),
22-
HTMLURL: r.HTMLURL(),
22+
HTMLURL: r.HTMLURL(ctx),
2323
TarURL: r.TarURL(),
2424
ZipURL: r.ZipURL(),
2525
UploadURL: r.APIUploadURL(),

services/mailer/mail_release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func mailNewRelease(ctx context.Context, lang string, tos []*user_model.User, re
7474
"Release": rel,
7575
"Subject": subject,
7676
"Language": locale.Language(),
77-
"Link": rel.HTMLURL(),
77+
"Link": rel.HTMLURL(ctx),
7878
}
7979

8080
var mailBody bytes.Buffer

0 commit comments

Comments
 (0)