diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 1ee6e98afbd..c4fc5354469 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -1443,11 +1443,11 @@ func ViewIssue(ctx *context.Context) {
}
if issue.IsPull && !ctx.Repo.CanRead(unit.TypeIssues) {
- ctx.Data["IssueType"] = "pulls"
+ ctx.Data["IssueDependencySearchType"] = "pulls"
} else if !issue.IsPull && !ctx.Repo.CanRead(unit.TypePullRequests) {
- ctx.Data["IssueType"] = "issues"
+ ctx.Data["IssueDependencySearchType"] = "issues"
} else {
- ctx.Data["IssueType"] = "all"
+ ctx.Data["IssueDependencySearchType"] = "all"
}
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(unit.TypeProjects)
diff --git a/services/repository/push.go b/services/repository/push.go
index 36c7927ab61..06ad65e48fb 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -318,9 +318,10 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
}
releases, err := db.Find[repo_model.Release](ctx, repo_model.FindReleasesOptions{
- RepoID: repo.ID,
- TagNames: tags,
- IncludeTags: true,
+ RepoID: repo.ID,
+ TagNames: tags,
+ IncludeDrafts: true,
+ IncludeTags: true,
})
if err != nil {
return fmt.Errorf("db.Find[repo_model.Release]: %w", err)
@@ -407,13 +408,17 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
newReleases = append(newReleases, rel)
} else {
- rel.Title = parts[0]
- rel.Note = note
rel.Sha1 = commit.ID.String()
rel.CreatedUnix = timeutil.TimeStamp(createdAt.Unix())
rel.NumCommits = commitsCount
- if rel.IsTag && author != nil {
- rel.PublisherID = author.ID
+ if rel.IsTag {
+ rel.Title = parts[0]
+ rel.Note = note
+ if author != nil {
+ rel.PublisherID = author.ID
+ }
+ } else {
+ rel.IsDraft = false
}
if err = repo_model.UpdateRelease(ctx, rel); err != nil {
return fmt.Errorf("Update: %w", err)
diff --git a/services/webhook/discord.go b/services/webhook/discord.go
index 59e87a7e1fb..c562d981680 100644
--- a/services/webhook/discord.go
+++ b/services/webhook/discord.go
@@ -156,7 +156,7 @@ func (d discordConvertor) Push(p *api.PushPayload) (DiscordPayload, error) {
// for each commit, generate attachment text
for i, commit := range p.Commits {
// limit the commit message display to just the summary, otherwise it would be hard to read
- message := strings.TrimRight(strings.SplitN(commit.Message, "\n", 1)[0], "\r")
+ message := strings.TrimRight(strings.SplitN(commit.Message, "\n", 2)[0], "\r")
// a limit of 50 is set because GitHub does the same
if utf8.RuneCountInString(message) > 50 {
diff --git a/services/webhook/discord_test.go b/services/webhook/discord_test.go
index fbb4b24ef12..36b99d452ea 100644
--- a/services/webhook/discord_test.go
+++ b/services/webhook/discord_test.go
@@ -80,12 +80,26 @@ func TestDiscordPayload(t *testing.T) {
assert.Equal(t, p.Sender.AvatarURL, pl.Embeds[0].Author.IconURL)
})
- t.Run("PushWithLongCommitMessage", func(t *testing.T) {
+ t.Run("PushWithMultilineCommitMessage", func(t *testing.T) {
p := pushTestMultilineCommitMessagePayload()
pl, err := dc.Push(p)
require.NoError(t, err)
+ assert.Len(t, pl.Embeds, 1)
+ assert.Equal(t, "[test/repo:test] 2 new commits", pl.Embeds[0].Title)
+ assert.Equal(t, "[2020558](http://localhost:3000/test/repo/commit/2020558fe2e34debb818a514715839cabd25e778) chore: This is a commit summary - user1\n[2020558](http://localhost:3000/test/repo/commit/2020558fe2e34debb818a514715839cabd25e778) chore: This is a commit summary - user1", pl.Embeds[0].Description)
+ assert.Equal(t, p.Sender.UserName, pl.Embeds[0].Author.Name)
+ assert.Equal(t, setting.AppURL+p.Sender.UserName, pl.Embeds[0].Author.URL)
+ assert.Equal(t, p.Sender.AvatarURL, pl.Embeds[0].Author.IconURL)
+ })
+
+ t.Run("PushWithLongCommitSummary", func(t *testing.T) {
+ p := pushTestPayloadWithCommitMessage("This is a commit summary ⚠️⚠️⚠️⚠️ containing 你好 ⚠️⚠️️\n\nThis is the message body")
+
+ pl, err := dc.Push(p)
+ require.NoError(t, err)
+
assert.Len(t, pl.Embeds, 1)
assert.Equal(t, "[test/repo:test] 2 new commits", pl.Embeds[0].Title)
assert.Equal(t, "[2020558](http://localhost:3000/test/repo/commit/2020558fe2e34debb818a514715839cabd25e778) This is a commit summary ⚠️⚠️⚠️⚠️ containing 你好... - user1\n[2020558](http://localhost:3000/test/repo/commit/2020558fe2e34debb818a514715839cabd25e778) This is a commit summary ⚠️⚠️⚠️⚠️ containing 你好... - user1", pl.Embeds[0].Description)
diff --git a/services/webhook/general_test.go b/services/webhook/general_test.go
index d6a77c94425..ef1ec7f324c 100644
--- a/services/webhook/general_test.go
+++ b/services/webhook/general_test.go
@@ -68,7 +68,7 @@ func pushTestPayload() *api.PushPayload {
}
func pushTestMultilineCommitMessagePayload() *api.PushPayload {
- return pushTestPayloadWithCommitMessage("This is a commit summary ⚠️⚠️⚠️⚠️ containing 你好 ⚠️⚠️️\n\nThis is the message body.")
+ return pushTestPayloadWithCommitMessage("chore: This is a commit summary\n\nThis is a commit description.")
}
func pushTestPayloadWithCommitMessage(message string) *api.PushPayload {
diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl
index 4b9d9f5bbec..60eb2fe1f82 100644
--- a/templates/base/footer_content.tmpl
+++ b/templates/base/footer_content.tmpl
@@ -17,12 +17,12 @@
{{end}}
-
+
{{svg "octicon-globe" 14}} {{ctx.Locale.LangName}}
{{ctx.Locale.Tr "licenses"}}
diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl
index 5793a8bfda8..286ac0cd051 100644
--- a/templates/repo/issue/branch_selector_field.tmpl
+++ b/templates/repo/issue/branch_selector_field.tmpl
@@ -44,6 +44,5 @@
-
{{end}}
diff --git a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl
new file mode 100644
index 00000000000..ad4ce96a475
--- /dev/null
+++ b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl
@@ -0,0 +1,13 @@
+{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}}
+ {{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}}
+
+
+
+
+
+ {{end}}
+{{end}}
diff --git a/templates/repo/issue/sidebar/assignee_list.tmpl b/templates/repo/issue/sidebar/assignee_list.tmpl
new file mode 100644
index 00000000000..260f7c5be4d
--- /dev/null
+++ b/templates/repo/issue/sidebar/assignee_list.tmpl
@@ -0,0 +1,46 @@
+
+
+
+
+
{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}
+
+ {{range .Issue.Assignees}}
+
+
+
+ {{end}}
+
+
diff --git a/templates/repo/issue/sidebar/due_date.tmpl b/templates/repo/issue/sidebar/due_date.tmpl
new file mode 100644
index 00000000000..e6e19f6f86f
--- /dev/null
+++ b/templates/repo/issue/sidebar/due_date.tmpl
@@ -0,0 +1,29 @@
+
+{{ctx.Locale.Tr "repo.issues.due_date"}}
+
diff --git a/templates/repo/issue/sidebar/issue_dependencies.tmpl b/templates/repo/issue/sidebar/issue_dependencies.tmpl
new file mode 100644
index 00000000000..837bcd56705
--- /dev/null
+++ b/templates/repo/issue/sidebar/issue_dependencies.tmpl
@@ -0,0 +1,149 @@
+{{if .Repository.IsDependenciesEnabled ctx}}
+
+
+
+ {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}}
+
{{ctx.Locale.Tr "repo.issues.dependency.title"}}
+
+
+ {{if .Issue.IsPull}}
+ {{ctx.Locale.Tr "repo.issues.dependency.pr_no_dependencies"}}
+ {{else}}
+ {{ctx.Locale.Tr "repo.issues.dependency.issue_no_dependencies"}}
+ {{end}}
+
+ {{end}}
+
+ {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}}
+
+ {{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}}
+
+
+ {{range .BlockingDependencies}}
+
+ {{end}}
+ {{if .BlockingDependenciesNotPermitted}}
+
+ {{ctx.Locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}}
+
+ {{end}}
+
+ {{end}}
+
+ {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}}
+
+ {{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}}
+
+
+ {{range .BlockedByDependencies}}
+
+ {{end}}
+ {{if $.CanCreateIssueDependencies}}
+ {{range .BlockedByDependenciesNotPermitted}}
+
+
+
+ {{svg "octicon-lock" 16}}
+
+ #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}
+
+
+
+ {{.Repository.OwnerName}}/{{.Repository.Name}}
+
+
+
+
+ {{end}}
+ {{else if .BlockedByDependenciesNotPermitted}}
+
+ {{ctx.Locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}}
+
+ {{end}}
+
+ {{end}}
+
+ {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
+
+ {{end}}
+
+
+ {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
+
+
+
+
+
+
+
{{if .Issue.IsPull}}
+ {{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}}
+ {{else}}
+ {{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}}
+ {{end}}
+
+ {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}}
+ {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}}
+ {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}}
+
+ {{end}}
+{{end}}
diff --git a/templates/repo/issue/sidebar/issue_management.tmpl b/templates/repo/issue/sidebar/issue_management.tmpl
new file mode 100644
index 00000000000..3342d992129
--- /dev/null
+++ b/templates/repo/issue/sidebar/issue_management.tmpl
@@ -0,0 +1,118 @@
+{{if and .IsRepoAdmin (not .Repository.IsArchived)}}
+
+
+ {{if or .PinEnabled .Issue.IsPinned}}
+
+ {{end}}
+
+
+
+
+
+
+ {{if .Issue.IsLocked}}
+ {{ctx.Locale.Tr "repo.issues.unlock.notice_1"}}
+ {{ctx.Locale.Tr "repo.issues.unlock.notice_2"}}
+ {{else}}
+ {{ctx.Locale.Tr "repo.issues.lock.notice_1"}}
+ {{ctx.Locale.Tr "repo.issues.lock.notice_2"}}
+ {{ctx.Locale.Tr "repo.issues.lock.notice_3"}}
+ {{end}}
+
+
+
+
+
+
+
+{{end}}
diff --git a/templates/repo/issue/sidebar/milestone_list.tmpl b/templates/repo/issue/sidebar/milestone_list.tmpl
new file mode 100644
index 00000000000..e9ca02f77a1
--- /dev/null
+++ b/templates/repo/issue/sidebar/milestone_list.tmpl
@@ -0,0 +1,23 @@
+
+
+
+
{{ctx.Locale.Tr "repo.issues.new.no_milestone"}}
+
+ {{if .Issue.Milestone}}
+
+ {{end}}
+
+
diff --git a/templates/repo/issue/sidebar/participant_list.tmpl b/templates/repo/issue/sidebar/participant_list.tmpl
new file mode 100644
index 00000000000..91c36fc01ef
--- /dev/null
+++ b/templates/repo/issue/sidebar/participant_list.tmpl
@@ -0,0 +1,11 @@
+{{if .Participants}}
+
+ {{ctx.Locale.Tr "repo.issues.num_participants" .NumParticipants}}
+
+{{end}}
diff --git a/templates/repo/issue/sidebar/project_list.tmpl b/templates/repo/issue/sidebar/project_list.tmpl
new file mode 100644
index 00000000000..ec79f8032f7
--- /dev/null
+++ b/templates/repo/issue/sidebar/project_list.tmpl
@@ -0,0 +1,53 @@
+{{if .IsProjectsEnabled}}
+
+
+
+
+
{{ctx.Locale.Tr "repo.issues.new.no_projects"}}
+
+ {{if .Issue.Project}}
+
+ {{end}}
+
+
+{{end}}
diff --git a/templates/repo/issue/sidebar/reference_link.tmpl b/templates/repo/issue/sidebar/reference_link.tmpl
new file mode 100644
index 00000000000..6b8f120c7b0
--- /dev/null
+++ b/templates/repo/issue/sidebar/reference_link.tmpl
@@ -0,0 +1,8 @@
+
+
+ {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}}
+
+ {{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}
+
+
+
diff --git a/templates/repo/issue/sidebar/reviewer_list.tmpl b/templates/repo/issue/sidebar/reviewer_list.tmpl
new file mode 100644
index 00000000000..cf4d067c0f8
--- /dev/null
+++ b/templates/repo/issue/sidebar/reviewer_list.tmpl
@@ -0,0 +1,116 @@
+
+
+
+
+
{{ctx.Locale.Tr "repo.issues.new.no_reviewers"}}
+
+ {{range .PullReviewers}}
+
+
+ {{if .User}}
+
+ {{else if .Team}}
+ {{svg "octicon-people" 20 "tw-mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}
+ {{end}}
+
+
+ {{if (and $.Permission.IsAdmin (or (eq .Review.Type 1) (eq .Review.Type 3)) (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged))}}
+
+ {{svg "octicon-x" 20}}
+
+
+
+
+
+ {{ctx.Locale.Tr "repo.issues.dismiss_review_warning"}}
+
+
+
+
+ {{end}}
+ {{if .Review.Stale}}
+
+ {{svg "octicon-hourglass" 16}}
+
+ {{end}}
+ {{if and .CanChange (or .Checked (and (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged)))}}
+
{{svg (Iif .Checked "octicon-trash" "octicon-sync")}}
+ {{end}}
+
+ {{svg (printf "octicon-%s" .Review.Type.Icon) 16 (printf "text %s" (.Review.HTMLTypeColorName))}}
+
+
+
+ {{end}}
+ {{range .OriginalReviews}}
+
+
+
+
+ {{svg (printf "octicon-%s" .Type.Icon) 16 (printf "text %s" (.HTMLTypeColorName))}}
+
+
+
+ {{end}}
+
+
diff --git a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl
new file mode 100644
index 00000000000..9a49664b0e6
--- /dev/null
+++ b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl
@@ -0,0 +1,75 @@
+{{if .Repository.IsTimetrackerEnabled ctx}}
+ {{if and .CanUseTimetracker (not .Repository.IsArchived)}}
+
+
+
{{ctx.Locale.Tr "repo.issues.tracker"}}
+
+
+
+ {{if $.IsStopwatchRunning}}
+
+
+ {{else}}
+ {{if .HasUserStopwatch}}
+
+ {{ctx.Locale.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL}}
+
+ {{end}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{end}}
+
+
+ {{end}}
+ {{if .WorkingUsers}}
+
+
+ {{end}}
+{{end}}
diff --git a/templates/repo/issue/sidebar/watch_notification.tmpl b/templates/repo/issue/sidebar/watch_notification.tmpl
new file mode 100644
index 00000000000..aafee87ba34
--- /dev/null
+++ b/templates/repo/issue/sidebar/watch_notification.tmpl
@@ -0,0 +1,9 @@
+{{if and $.IssueWatch (not .Repository.IsArchived)}}
+
+
+
{{ctx.Locale.Tr "notification.notifications"}}
+
+ {{template "repo/issue/view_content/watching" .}}
+
+
+{{end}}
diff --git a/templates/repo/issue/sidebar/wip_switch.tmpl b/templates/repo/issue/sidebar/wip_switch.tmpl
new file mode 100644
index 00000000000..2f8994673e9
--- /dev/null
+++ b/templates/repo/issue/sidebar/wip_switch.tmpl
@@ -0,0 +1,7 @@
+{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}}
+
+{{end}}
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index 1f9bbd86aa4..3f7b2dc78f6 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -1,11 +1,4 @@
-
-
-
-
-
-
-
{{$createdStr:= DateUtils.TimeSince .Issue.CreatedUnix}}
-
- {{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.issues.dependency.pr_no_dependencies"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.dependency.issue_no_dependencies"}} - {{end}} -
- {{end}} - - {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}} - - {{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}} - -{{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}} - {{end}}
-- {{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.pulls.delete.text"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.delete.text"}} - {{end}} -
-