Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6b055dd
Add release notification and fix repository transfer/commit notification
lunny Jun 20, 2025
803a3a4
fix
lunny Jun 20, 2025
4163c6d
Fix bug
lunny Jun 20, 2025
01a0b8a
Add tests and fix lint
lunny Jun 21, 2025
49e9ab0
Fix lint
lunny Jun 21, 2025
60227c5
Merge branch 'main' into lunny/improve_notification
lunny Jun 21, 2025
fd17f05
improvements
lunny Jun 21, 2025
7a1cc34
Merge branch 'main' into lunny/improve_notification
lunny Jun 21, 2025
11bd0ea
improvements
lunny Jul 3, 2025
6f79a1a
Merge branch 'main' into lunny/improve_notification
lunny Jul 3, 2025
7aaa2d6
remove nolint
lunny Jul 3, 2025
5dc32a3
Fix typo
lunny Jul 3, 2025
8b0071d
Merge branch 'main' into lunny/improve_notification
lunny Jul 3, 2025
5676169
Merge branch 'main' into lunny/improve_notification
lunny Jul 21, 2025
886c476
Merge branch 'main' into lunny/improve_notification
lunny Jul 31, 2025
fa0262e
Merge branch 'main' into lunny/improve_notification
lunny Aug 1, 2025
2ffcd2e
improvement
lunny Aug 3, 2025
df24a1f
Merge branch 'main' into lunny/improve_notification
lunny Aug 3, 2025
f37de47
Use commit title instead in notification
lunny Aug 12, 2025
d3b6d84
Some improvements
lunny Aug 23, 2025
88143cd
Merge branch 'main' into lunny/improve_notification
lunny Aug 23, 2025
ff70703
Merge branch 'main' into lunny/improve_notification
lunny Aug 28, 2025
0614610
add contexts
lunny Aug 28, 2025
b48620b
Revert "add contexts"
lunny Aug 30, 2025
a024ad9
Merge branch 'main' into lunny/improve_notification
lunny Aug 30, 2025
fa269b6
Merge branch 'main' into lunny/improve_notification
lunny Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/activities/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (n *Notification) HTMLURL(ctx context.Context) string {
case NotificationSourceRepository:
return n.Repository.HTMLURL(ctx)
case NotificationSourceRelease:
return n.Release.HTMLURL()
return n.Release.HTMLURL(ctx)
}
return ""
}
Expand Down
4 changes: 2 additions & 2 deletions models/repo/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func (r *Release) TarURL() string {
}

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

// APIUploadURL the api url to upload assets to a release. release must have attributes loaded
Expand Down
2 changes: 1 addition & 1 deletion routers/web/feed/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func releasesToFeedItems(ctx *context.Context, releases []*repo_model.Release) (
title = rel.Title
}

link := &feeds.Link{Href: rel.HTMLURL()}
link := &feeds.Link{Href: rel.HTMLURL(ctx)}
rctx := renderhelper.NewRenderContextRepoComment(ctx, rel.Repo).WithUseAbsoluteLink(true)
content, err = markdown.RenderString(rctx,
rel.Note)
Expand Down
6 changes: 3 additions & 3 deletions services/convert/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification)
}
}
case activities_model.NotificationSourceCommit:
url := n.Repository.HTMLURL() + "/commit/" + url.PathEscape(n.CommitID)
url := n.Repository.HTMLURL(ctx) + "/commit/" + url.PathEscape(n.CommitID)
title, _ := git.SplitCommitTitleBody(n.Commit.CommitMessage, 255)
result.Subject = &api.NotificationSubject{
Type: api.NotifySubjectCommit,
Expand All @@ -83,14 +83,14 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification)
Title: n.Repository.FullName(),
// FIXME: this is a relative URL, rather useless and inconsistent, but keeping for backwards compat
URL: n.Repository.Link(),
HTMLURL: n.Repository.HTMLURL(),
HTMLURL: n.Repository.HTMLURL(ctx),
}
case activities_model.NotificationSourceRelease:
result.Subject = &api.NotificationSubject{
Type: api.NotifySubjectRelease,
Title: n.Release.Title,
URL: n.Release.Link(),
HTMLURL: n.Release.HTMLURL(),
HTMLURL: n.Release.HTMLURL(ctx),
}
}

Expand Down
2 changes: 1 addition & 1 deletion services/convert/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func ToAPIRelease(ctx context.Context, repo *repo_model.Repository, r *repo_mode
Title: r.Title,
Note: r.Note,
URL: r.APIURL(),
HTMLURL: r.HTMLURL(),
HTMLURL: r.HTMLURL(ctx),
TarURL: r.TarURL(),
ZipURL: r.ZipURL(),
UploadURL: r.APIUploadURL(),
Expand Down
2 changes: 1 addition & 1 deletion services/mailer/mail_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func mailNewRelease(ctx context.Context, lang string, tos []*user_model.User, re
"Release": rel,
"Subject": subject,
"Language": locale.Language(),
"Link": rel.HTMLURL(),
"Link": rel.HTMLURL(ctx),
}

var mailBody bytes.Buffer
Expand Down