From 8941f7fc01eb76ad66768a828bcc9bc8b8887731 Mon Sep 17 00:00:00 2001
From: Flutterlice
Date: Wed, 1 Jan 2020 05:54:21 +0500
Subject: [PATCH 01/46] Fix for a wrong URL in activity page of repository.
(Using config url instead of an actual one) (#9571)
---
templates/repo/activity.tmpl | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl
index 504fd32300309..6432630af4caf 100644
--- a/templates/repo/activity.tmpl
+++ b/templates/repo/activity.tmpl
@@ -123,7 +123,7 @@
{{$.i18n.Tr "repo.activity.published_release_label"}}
{{.TagName}}
{{if not .IsTag}}
- {{.Title}}
+ {{.Title}}
{{end}}
{{TimeSinceUnix .CreatedUnix $.Lang}}
@@ -140,7 +140,7 @@
{{range .Activity.MergedPRs}}
{{$.i18n.Tr "repo.activity.merged_prs_label"}}
- #{{.Index}} {{.Issue.Title}}
+ #{{.Index}} {{.Issue.Title}}
{{TimeSinceUnix .MergedUnix $.Lang}}
{{end}}
@@ -156,7 +156,7 @@
{{range .Activity.OpenedPRs}}
{{$.i18n.Tr "repo.activity.opened_prs_label"}}
- #{{.Index}} {{.Issue.Title}}
+ #{{.Index}} {{.Issue.Title}}
{{TimeSinceUnix .Issue.CreatedUnix $.Lang}}
{{end}}
@@ -172,7 +172,7 @@
{{range .Activity.ClosedIssues}}
{{$.i18n.Tr "repo.activity.closed_issue_label"}}
- #{{.Index}} {{.Title}}
+ #{{.Index}} {{.Title}}
{{TimeSinceUnix .ClosedUnix $.Lang}}
{{end}}
@@ -188,7 +188,7 @@
{{range .Activity.OpenedIssues}}
{{$.i18n.Tr "repo.activity.new_issue_label"}}
- #{{.Index}} {{.Title}}
+ #{{.Index}} {{.Title}}
{{TimeSinceUnix .CreatedUnix $.Lang}}
{{end}}
@@ -209,9 +209,9 @@
{{$.i18n.Tr "repo.activity.unresolved_conv_label"}}
#{{.Index}}
{{if .IsPull}}
- {{.Title}}
+ {{.Title}}
{{else}}
- {{.Title}}
+ {{.Title}}
{{end}}
{{TimeSinceUnix .UpdatedUnix $.Lang}}
From 7bdf17ec29851b857bf88d5e5f39436799732dd6 Mon Sep 17 00:00:00 2001
From: John Olheiser <42128690+jolheiser@users.noreply.github.com>
Date: Tue, 31 Dec 2019 21:54:56 -0600
Subject: [PATCH 02/46] Use limited commits (#9572)
Signed-off-by: jolheiser
---
services/mirror/mirror.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/mirror/mirror.go b/services/mirror/mirror.go
index 7fc6e97b463a1..28b2e2a12728a 100644
--- a/services/mirror/mirror.go
+++ b/services/mirror/mirror.go
@@ -410,7 +410,7 @@ func syncMirror(repoID string) {
theCommits.CompareURL = m.Repo.ComposeCompareURL(oldCommitID, newCommitID)
- notification.NotifySyncPushCommits(m.Repo.MustOwner(), m.Repo, result.refName, oldCommitID, newCommitID, models.ListToPushCommits(commits))
+ notification.NotifySyncPushCommits(m.Repo.MustOwner(), m.Repo, result.refName, oldCommitID, newCommitID, theCommits)
}
// Get latest commit date and update to current repository updated time
From a864d61ee629dfc3aa5e75a5271354db5088f70e Mon Sep 17 00:00:00 2001
From: John Olheiser <42128690+jolheiser@users.noreply.github.com>
Date: Tue, 31 Dec 2019 23:06:15 -0600
Subject: [PATCH 03/46] Add box-shadow to blue buttons in normal theme (#9573)
Signed-off-by: jolheiser
Co-authored-by: techknowlogick
---
web_src/less/_base.less | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/web_src/less/_base.less b/web_src/less/_base.less
index 721863a70fb45..3da3ae6b99d10 100644
--- a/web_src/less/_base.less
+++ b/web_src/less/_base.less
@@ -1172,3 +1172,9 @@ i.icon.centerlock {
.octicon-tiny {
font-size: 0.85714286rem;
}
+
+.ui.basic.blue.button,
+.ui.basic.blue.buttons .button {
+ box-shadow: inset 0 0 0 1px #1678c2 !important;
+ color: #1678c2 !important;
+}
From d1798f77f62988828c004fcf8d234bff6340deb7 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Wed, 1 Jan 2020 17:08:13 +0100
Subject: [PATCH 04/46] swagger UI: hide iretating search field (#9554)
---
templates/swagger/ui.tmpl | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/templates/swagger/ui.tmpl b/templates/swagger/ui.tmpl
index 0125ee4a19969..7bc005e334417 100644
--- a/templates/swagger/ui.tmpl
+++ b/templates/swagger/ui.tmpl
@@ -85,13 +85,11 @@ window.onload = function() {
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
- SwaggerUIBundle.presets.apis,
- SwaggerUIStandalonePreset
+ SwaggerUIBundle.presets.apis
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
- ],
- layout: "StandaloneLayout"
+ ]
})
// End Swagger UI call region
From c620eb5b2d0d874da68ebd734d3864c5224f71f7 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Wed, 1 Jan 2020 23:51:10 +0100
Subject: [PATCH 05/46] Fix #9189 - API Allow only specific Colums to be
updated on Issue (#9539)
* dont insert "-1" in any case to issue.poster_id
* Make sure API cant override importand fields
* code format
* fix lint
* WIP test
* add missing poster_id
* fix test
* user.IsGhost handle nil
* CI.restart()
* make sure no -1 is realy added
* CI.restart()
* @lunny suggestion remove some not allowed fields
* seperate issue.LoadMilestone
* load milestone and return it on IssueEdit via API
* extend Test for TestAPIEditIssue
* fix fixtures
* declare allowedColumnsUpdateIssueByAPI only once
* Update Year
* no var just write id drecty into func cal
Co-authored-by: Lauris BH
---
integrations/api_issue_test.go | 58 ++++++++++++++++++++++++++++++++++
models/fixtures/issue.yml | 15 ++++++++-
models/fixtures/milestone.yml | 8 +++++
models/fixtures/repository.yml | 9 +++---
models/issue.go | 44 +++++++++++++++-----------
models/user.go | 8 +++++
routers/api/v1/repo/issue.go | 10 ++++--
routers/api/v1/repo/pull.go | 4 +--
8 files changed, 127 insertions(+), 29 deletions(-)
diff --git a/integrations/api_issue_test.go b/integrations/api_issue_test.go
index f412f5af085da..382fe606bf356 100644
--- a/integrations/api_issue_test.go
+++ b/integrations/api_issue_test.go
@@ -62,3 +62,61 @@ func TestAPICreateIssue(t *testing.T) {
Title: title,
})
}
+
+func TestAPIEditIssue(t *testing.T) {
+ defer prepareTestEnv(t)()
+
+ issueBefore := models.AssertExistsAndLoadBean(t, &models.Issue{ID: 10}).(*models.Issue)
+ repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: issueBefore.RepoID}).(*models.Repository)
+ owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
+ assert.NoError(t, issueBefore.LoadAttributes())
+ assert.Equal(t, int64(1019307200), int64(issueBefore.DeadlineUnix))
+ assert.Equal(t, api.StateOpen, issueBefore.State())
+
+ session := loginUser(t, owner.Name)
+ token := getTokenForLoggedInUser(t, session)
+
+ // update values of issue
+ issueState := "closed"
+ removeDeadline := true
+ milestone := int64(4)
+ body := "new content!"
+ title := "new title from api set"
+
+ urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d?token=%s", owner.Name, repo.Name, issueBefore.Index, token)
+ req := NewRequestWithJSON(t, "PATCH", urlStr, api.EditIssueOption{
+ State: &issueState,
+ RemoveDeadline: &removeDeadline,
+ Milestone: &milestone,
+ Body: &body,
+ Title: title,
+
+ // ToDo change more
+ })
+ resp := session.MakeRequest(t, req, http.StatusCreated)
+ var apiIssue api.Issue
+ DecodeJSON(t, resp, &apiIssue)
+
+ issueAfter := models.AssertExistsAndLoadBean(t, &models.Issue{ID: 10}).(*models.Issue)
+
+ // check deleted user
+ assert.Equal(t, int64(500), issueAfter.PosterID)
+ assert.NoError(t, issueAfter.LoadAttributes())
+ assert.Equal(t, int64(-1), issueAfter.PosterID)
+ assert.Equal(t, int64(-1), issueBefore.PosterID)
+ assert.Equal(t, int64(-1), apiIssue.Poster.ID)
+
+ // API response
+ assert.Equal(t, api.StateClosed, apiIssue.State)
+ assert.Equal(t, milestone, apiIssue.Milestone.ID)
+ assert.Equal(t, body, apiIssue.Body)
+ assert.True(t, apiIssue.Deadline == nil)
+ assert.Equal(t, title, apiIssue.Title)
+
+ // in database
+ assert.Equal(t, api.StateClosed, issueAfter.State())
+ assert.Equal(t, milestone, issueAfter.MilestoneID)
+ assert.Equal(t, int64(0), int64(issueAfter.DeadlineUnix))
+ assert.Equal(t, body, issueAfter.Content)
+ assert.Equal(t, title, issueAfter.Title)
+}
diff --git a/models/fixtures/issue.yml b/models/fixtures/issue.yml
index 6b57268a7a027..ecee7499f6f04 100644
--- a/models/fixtures/issue.yml
+++ b/models/fixtures/issue.yml
@@ -108,4 +108,17 @@
is_closed: false
is_pull: true
created_unix: 946684820
- updated_unix: 978307180
\ No newline at end of file
+ updated_unix: 978307180
+
+-
+ id: 10
+ repo_id: 42
+ index: 1
+ poster_id: 500
+ name: issue from deleted account
+ content: content from deleted account
+ is_closed: false
+ is_pull: false
+ created_unix: 946684830
+ updated_unix: 999307200
+ deadline_unix: 1019307200
diff --git a/models/fixtures/milestone.yml b/models/fixtures/milestone.yml
index 15f422fc3b5c2..a9ecb4ee6a6ef 100644
--- a/models/fixtures/milestone.yml
+++ b/models/fixtures/milestone.yml
@@ -21,3 +21,11 @@
content: content3
is_closed: true
num_issues: 0
+
+-
+ id: 4
+ repo_id: 42
+ name: milestone of repo42
+ content: content random
+ is_closed: false
+ num_issues: 0
diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml
index feec0b5fafb97..c7f4d4d1096ab 100644
--- a/models/fixtures/repository.yml
+++ b/models/fixtures/repository.yml
@@ -547,7 +547,8 @@
is_private: false
num_stars: 0
num_forks: 0
- num_issues: 0
+ num_issues: 1
+ num_milestones: 1
is_mirror: false
-
@@ -588,7 +589,7 @@
is_mirror: false
status: 0
--
+-
id: 46
owner_id: 26
lower_name: repo_external_tracker
@@ -600,7 +601,7 @@
is_mirror: false
status: 0
--
+-
id: 47
owner_id: 26
lower_name: repo_external_tracker_numeric
@@ -612,7 +613,7 @@
is_mirror: false
status: 0
--
+-
id: 48
owner_id: 26
lower_name: repo_external_tracker_alpha
diff --git a/models/issue.go b/models/issue.go
index 75f7bd818aa6e..c832b9d014473 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
+// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
@@ -239,6 +240,16 @@ func (issue *Issue) loadReactions(e Engine) (err error) {
return nil
}
+func (issue *Issue) loadMilestone(e Engine) (err error) {
+ if issue.Milestone == nil && issue.MilestoneID > 0 {
+ issue.Milestone, err = getMilestoneByRepoID(e, issue.RepoID, issue.MilestoneID)
+ if err != nil && !IsErrMilestoneNotExist(err) {
+ return fmt.Errorf("getMilestoneByRepoID [repo_id: %d, milestone_id: %d]: %v", issue.RepoID, issue.MilestoneID, err)
+ }
+ }
+ return nil
+}
+
func (issue *Issue) loadAttributes(e Engine) (err error) {
if err = issue.loadRepo(e); err != nil {
return
@@ -252,11 +263,8 @@ func (issue *Issue) loadAttributes(e Engine) (err error) {
return
}
- if issue.Milestone == nil && issue.MilestoneID > 0 {
- issue.Milestone, err = getMilestoneByRepoID(e, issue.RepoID, issue.MilestoneID)
- if err != nil && !IsErrMilestoneNotExist(err) {
- return fmt.Errorf("getMilestoneByRepoID [repo_id: %d, milestone_id: %d]: %v", issue.RepoID, issue.MilestoneID, err)
- }
+ if err = issue.loadMilestone(e); err != nil {
+ return
}
if err = issue.loadAssignees(e); err != nil {
@@ -296,6 +304,11 @@ func (issue *Issue) LoadAttributes() error {
return issue.loadAttributes(x)
}
+// LoadMilestone load milestone of this issue.
+func (issue *Issue) LoadMilestone() error {
+ return issue.loadMilestone(x)
+}
+
// GetIsRead load the `IsRead` field of the issue
func (issue *Issue) GetIsRead(userID int64) error {
issueUser := &IssueUser{IssueID: issue.ID, UID: userID}
@@ -1568,25 +1581,18 @@ func SearchIssueIDsByKeyword(kw string, repoIDs []int64, limit, start int) (int6
return total, ids, nil
}
-func updateIssue(e Engine, issue *Issue) error {
- _, err := e.ID(issue.ID).AllCols().Update(issue)
- if err != nil {
- return err
- }
- return nil
-}
-
-// UpdateIssue updates all fields of given issue.
-func UpdateIssue(issue *Issue) error {
+// UpdateIssueByAPI updates all allowed fields of given issue.
+func UpdateIssueByAPI(issue *Issue) error {
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
return err
}
- if err := updateIssue(sess, issue); err != nil {
- return err
- }
- if err := issue.loadPoster(sess); err != nil {
+
+ if _, err := sess.ID(issue.ID).Cols(
+ "name", "is_closed", "content", "milestone_id", "priority",
+ "deadline_unix", "updated_unix", "closed_unix", "is_locked").
+ Update(issue); err != nil {
return err
}
if err := issue.addCrossReferences(sess, issue.Poster, true); err != nil {
diff --git a/models/user.go b/models/user.go
index e832c2ed519b8..a8f2c6fd22336 100644
--- a/models/user.go
+++ b/models/user.go
@@ -791,6 +791,14 @@ func NewGhostUser() *User {
}
}
+// IsGhost check if user is fake user for a deleted account
+func (u *User) IsGhost() bool {
+ if u == nil {
+ return false
+ }
+ return u.ID == -1 && u.Name == "Ghost"
+}
+
var (
reservedUsernames = []string{
"attachments",
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 4396e6faaebe2..ad82d53e7a190 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -524,8 +524,8 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
}
}
- if err = models.UpdateIssue(issue); err != nil {
- ctx.Error(http.StatusInternalServerError, "UpdateIssue", err)
+ if err = models.UpdateIssueByAPI(issue); err != nil {
+ ctx.Error(http.StatusInternalServerError, "UpdateIssueByAPI", err)
return
}
if form.State != nil {
@@ -542,7 +542,11 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
// Refetch from database to assign some automatic values
issue, err = models.GetIssueByID(issue.ID)
if err != nil {
- ctx.Error(http.StatusInternalServerError, "GetIssueByID", err)
+ ctx.InternalServerError(err)
+ return
+ }
+ if err = issue.LoadMilestone(); err != nil {
+ ctx.InternalServerError(err)
return
}
ctx.JSON(http.StatusCreated, issue.APIFormat())
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 0392eb8e8c480..d0551320fdbc7 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -450,8 +450,8 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
}
}
- if err = models.UpdateIssue(issue); err != nil {
- ctx.Error(http.StatusInternalServerError, "UpdateIssue", err)
+ if err = models.UpdateIssueByAPI(issue); err != nil {
+ ctx.Error(http.StatusInternalServerError, "UpdateIssueByAPI", err)
return
}
if form.State != nil {
From 9cf7048a6a9bed8be9e02a3e0c1ae3336614cdc3 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Thu, 2 Jan 2020 03:07:15 +0100
Subject: [PATCH 06/46] Dont trigger notification twice on issue assignee
change (#9582)
---
routers/repo/issue.go | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 67c4ee3788194..925903fee420c 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -23,7 +23,6 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
- "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
@@ -1177,13 +1176,11 @@ func UpdateIssueAssignee(ctx *context.Context) {
return
}
- removed, comment, err := issue_service.ToggleAssignee(issue, ctx.User, assigneeID)
+ _, _, err = issue_service.ToggleAssignee(issue, ctx.User, assigneeID)
if err != nil {
ctx.ServerError("ToggleAssignee", err)
return
}
-
- notification.NotifyIssueChangeAssignee(ctx.User, issue, assignee, removed, comment)
}
}
ctx.JSON(200, map[string]interface{}{
From b2b10858c631dea6b7ac457f8e71c61b27bf4934 Mon Sep 17 00:00:00 2001
From: John Olheiser <42128690+jolheiser@users.noreply.github.com>
Date: Wed, 1 Jan 2020 21:02:11 -0600
Subject: [PATCH 07/46] Don't auto-init SimpleMDE for review textarea (#9574)
Signed-off-by: jolheiser
Co-authored-by: Lauris BH
---
templates/repo/diff/box.tmpl | 2 +-
web_src/js/index.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 9f3b271e24b5c..9b0738b1b7835 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -213,7 +213,7 @@
{{$.i18n.Tr "preview"}}
-
+
{{$.i18n.Tr "loading"}}
diff --git a/web_src/js/index.js b/web_src/js/index.js
index f4f08b828c8c4..3751c6d9e46f2 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -325,7 +325,7 @@ function initCommentForm() {
return;
}
- setCommentSimpleMDE($('.comment.form textarea'));
+ setCommentSimpleMDE($('.comment.form textarea:not(.review-textarea)'));
initBranchSelector();
initCommentPreviewTab($('.comment.form'));
initImagePaste($('.comment.form textarea'));
From 5b9283ddfea211ea0129449b6b501703306e5d25 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Thu, 2 Jan 2020 08:54:22 +0100
Subject: [PATCH 08/46] make sure Poster is loaded (#9583)
---
models/issue.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/models/issue.go b/models/issue.go
index c832b9d014473..485be4baef7be 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -1595,6 +1595,11 @@ func UpdateIssueByAPI(issue *Issue) error {
Update(issue); err != nil {
return err
}
+
+ if err := issue.loadPoster(sess); err != nil {
+ return err
+ }
+
if err := issue.addCrossReferences(sess, issue.Poster, true); err != nil {
return err
}
From 4ab072d9c2f10ecaf0c45913bf09a9d245ea9a98 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Thu, 2 Jan 2020 13:15:30 +0100
Subject: [PATCH 09/46] Changelog for 1.10.2 (#9586)
---
CHANGELOG.md | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cfefea3a22c8e..c11e75ced2c3f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,26 @@ This changelog goes through all the changes that have been made in each release
without substantial changes to our git log; to see the highlights of what has
been added to each release, please refer to the [blog](https://blog.gitea.io).
+## [1.10.2](https://github.com/go-gitea/gitea/releases/tag/v1.10.2) - 2020-01-02
+* BUGFIXES
+ * Allow only specific Columns to be updated on Issue via API (#9539) (#9580)
+ * Add ErrReactionAlreadyExist error (#9550) (#9564)
+ * Fix bug when migrate from API (#8631) (#9563)
+ * Use default avatar for ghost user (#9536) (#9537)
+ * Fix repository issues pagination bug when there are more than one label filter (#9512) (#9528)
+ * Fix deleted branch not removed when push the branch again (#9516) (#9524)
+ * Fix missing repository status when migrating repository via API (#9511)
+ * Trigger webhook when deleting a branch after merging a PR (#9510)
+ * Fix paging on /repos/{owner}/{repo}/git/trees/{sha} API endpoint (#9482)
+ * Fix NewCommitStatus (#9434) (#9435)
+ * Use OriginalURL instead of CloneAddr in migration logging (#9418) (#9420)
+ * Fix Slack webhook payload title generation to work with Mattermost (#9404)
+ * DefaultBranch needs to be prefixed by BranchPrefix (#9356) (#9359)
+ * Fix issue indexer not triggered when migrating a repository (#9333)
+ * Fix bug that release attachment files not deleted when deleting repository (#9322) (#9329)
+ * Fix migration releases (#9319) (#9326) (#9328)
+ * Fix File Edit: Author/Committer interchanged (#9297) (#9300)
+
## [1.10.1](https://github.com/go-gitea/gitea/releases/tag/v1.10.1) - 2019-12-05
* BUGFIXES
* Fix max length check and limit in multiple repo forms (#9148) (#9204)
From 09bf77bc4f1eeac16bfde8979ab448657cd0aaf3 Mon Sep 17 00:00:00 2001
From: GiteaBot
Date: Thu, 2 Jan 2020 12:18:28 +0000
Subject: [PATCH 10/46] [skip ci] Updated translations via Crowdin
---
options/locale/locale_pt-BR.ini | 1 +
1 file changed, 1 insertion(+)
diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini
index 19e30c4631681..68c3c4b752cd5 100644
--- a/options/locale/locale_pt-BR.ini
+++ b/options/locale/locale_pt-BR.ini
@@ -959,6 +959,7 @@ issues.add_time=Adicionar tempo manualmente
issues.add_time_short=Adicionar tempo
issues.add_time_cancel=Cancelar
issues.add_time_history=`adicionou tempo gasto %s`
+issues.del_time_history=`removeu tempo gasto %s`
issues.add_time_hours=Horas
issues.add_time_minutes=Minutos
issues.add_time_sum_to_small=Nenhum tempo foi inserido.
From b3c5b4b0d12ae42d10cb677deb9abdef6b044166 Mon Sep 17 00:00:00 2001
From: John Olheiser <42128690+jolheiser@users.noreply.github.com>
Date: Thu, 2 Jan 2020 09:53:08 -0600
Subject: [PATCH 11/46] Update version in docs (#9588)
---
docs/config.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/config.yaml b/docs/config.yaml
index a0a349a78062f..cbfcd49e6ed91 100644
--- a/docs/config.yaml
+++ b/docs/config.yaml
@@ -18,7 +18,7 @@ params:
description: Git with a cup of tea
author: The Gitea Authors
website: https://docs.gitea.io
- version: 1.10.1
+ version: 1.10.2
outputs:
home:
From 134e3fdf3d271f1015d062c74d55e3f28f7825d6 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Thu, 2 Jan 2020 22:27:31 +0100
Subject: [PATCH 12/46] [API] dont reqToken on GetReactions (fix #9543) (#9548)
* dont reqToken on GetReactions
* ctx.Repo.CanWrite has ctx.User.IsAdmin in It
Co-authored-by: Lauris BH
---
routers/api/v1/api.go | 12 ++++++------
routers/api/v1/repo/issue_reaction.go | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 0bb5320b16021..e4288f40f650b 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -664,10 +664,10 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Combo("", reqToken()).
Patch(mustNotBeArchived, bind(api.EditIssueCommentOption{}), repo.EditIssueComment).
Delete(repo.DeleteIssueComment)
- m.Combo("/reactions", reqToken()).
+ m.Combo("/reactions").
Get(repo.GetIssueCommentReactions).
- Post(bind(api.EditReactionOption{}), repo.PostIssueCommentReaction).
- Delete(bind(api.EditReactionOption{}), repo.DeleteIssueCommentReaction)
+ Post(bind(api.EditReactionOption{}), reqToken(), repo.PostIssueCommentReaction).
+ Delete(bind(api.EditReactionOption{}), reqToken(), repo.DeleteIssueCommentReaction)
})
})
m.Group("/:index", func() {
@@ -704,10 +704,10 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Put("/:user", reqToken(), repo.AddIssueSubscription)
m.Delete("/:user", reqToken(), repo.DelIssueSubscription)
})
- m.Combo("/reactions", reqToken()).
+ m.Combo("/reactions").
Get(repo.GetIssueReactions).
- Post(bind(api.EditReactionOption{}), repo.PostIssueReaction).
- Delete(bind(api.EditReactionOption{}), repo.DeleteIssueReaction)
+ Post(bind(api.EditReactionOption{}), reqToken(), repo.PostIssueReaction).
+ Delete(bind(api.EditReactionOption{}), reqToken(), repo.DeleteIssueReaction)
})
}, mustEnableIssuesOrPulls)
m.Group("/labels", func() {
diff --git a/routers/api/v1/repo/issue_reaction.go b/routers/api/v1/repo/issue_reaction.go
index bbc767cc99ad4..d612b20d7e5e1 100644
--- a/routers/api/v1/repo/issue_reaction.go
+++ b/routers/api/v1/repo/issue_reaction.go
@@ -55,7 +55,7 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
return
}
- if !ctx.Repo.CanRead(models.UnitTypeIssues) && !ctx.User.IsAdmin {
+ if !ctx.Repo.CanRead(models.UnitTypeIssues) {
ctx.Error(http.StatusForbidden, "GetIssueCommentReactions", errors.New("no permission to get reactions"))
return
}
@@ -179,7 +179,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp
ctx.Error(http.StatusInternalServerError, "comment.LoadIssue() failed", err)
}
- if comment.Issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) && !ctx.User.IsAdmin {
+ if comment.Issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) {
ctx.Error(http.StatusForbidden, "ChangeIssueCommentReaction", errors.New("no permission to change reaction"))
return
}
@@ -261,7 +261,7 @@ func GetIssueReactions(ctx *context.APIContext) {
return
}
- if !ctx.Repo.CanRead(models.UnitTypeIssues) && !ctx.User.IsAdmin {
+ if !ctx.Repo.CanRead(models.UnitTypeIssues) {
ctx.Error(http.StatusForbidden, "GetIssueReactions", errors.New("no permission to get reactions"))
return
}
@@ -380,7 +380,7 @@ func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, i
return
}
- if issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) && !ctx.User.IsAdmin {
+ if issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) {
ctx.Error(http.StatusForbidden, "ChangeIssueCommentReaction", errors.New("no permission to change reaction"))
return
}
From b39fab41c8b315ba7ddf9f9a4cc522385cf9f720 Mon Sep 17 00:00:00 2001
From: mrsdizzie
Date: Fri, 3 Jan 2020 12:13:22 -0500
Subject: [PATCH 13/46] Some more e-mail notification fixes (#9596)
* Some more e-mail notification fixes
A few more small e-mail notification fixes/changes
* Style footer of notification email to be smaller
* Include text for when pull request is merged
* Don't include original body of issue or PR when merging/closing by
setting issue.Content to "" in these cases
* Set Re: prefix and meessage-ID headers based on actName instead of checking for a
comment. This fixes a bug where certain actions that didn't have a
comment were setting Message-ID instead of In-Reply-To which caused some
mail programs not to show those messages as they would have had the same
Message-ID as a previous message. Also fixes the case where a final
comment and closing message would have been displayed out of order if
you didn't have a copy of the original issue/pr cretion message.
* Update other template footers for consistency
---
modules/notification/mail/mail.go | 3 ++-
services/mailer/mail.go | 10 ++++++----
templates/mail/issue/assigned.tmpl | 16 ++++++++++------
templates/mail/issue/default.tmpl | 15 +++++++++++----
templates/mail/notify/collaborator.tmpl | 15 ++++++++++-----
5 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go
index 5148434dca23e..6cc6fda14bbb6 100644
--- a/modules/notification/mail/mail.go
+++ b/modules/notification/mail/mail.go
@@ -53,6 +53,7 @@ func (m *mailNotifier) NotifyNewIssue(issue *models.Issue) {
func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
var actionType models.ActionType
+ issue.Content = ""
if issue.IsPull {
if isClosed {
actionType = models.ActionClosePullRequest
@@ -105,7 +106,7 @@ func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode
log.Error("pr.LoadIssue: %v", err)
return
}
-
+ pr.Issue.Content = ""
if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullRequest); err != nil {
log.Error("MailParticipants: %v", err)
}
diff --git a/services/mailer/mail.go b/services/mailer/mail.go
index a8768de6cdbde..fa40170d464eb 100644
--- a/services/mailer/mail.go
+++ b/services/mailer/mail.go
@@ -177,7 +177,6 @@ func composeIssueCommentMessages(ctx *mailCommentContext, tos []string, fromMent
commentType := models.CommentTypeComment
if ctx.Comment != nil {
- prefix = "Re: "
commentType = ctx.Comment.Type
link = ctx.Issue.HTMLURL() + "#" + ctx.Comment.HashTag()
} else {
@@ -189,13 +188,16 @@ func composeIssueCommentMessages(ctx *mailCommentContext, tos []string, fromMent
reviewType = ctx.Comment.Review.Type
}
- fallback = prefix + fallbackMailSubject(ctx.Issue)
-
// This is the body of the new issue or comment, not the mail body
body := string(markup.RenderByType(markdown.MarkupName, []byte(ctx.Content), ctx.Issue.Repo.HTMLURL(), ctx.Issue.Repo.ComposeMetas()))
actType, actName, tplName := actionToTemplate(ctx.Issue, ctx.ActionType, commentType, reviewType)
+ if actName != "new" {
+ prefix = "Re: "
+ }
+ fallback = prefix + fallbackMailSubject(ctx.Issue)
+
if ctx.Comment != nil && ctx.Comment.Review != nil {
reviewComments = make([]*models.Comment, 0, 10)
for _, lines := range ctx.Comment.Review.CodeComments {
@@ -247,7 +249,7 @@ func composeIssueCommentMessages(ctx *mailCommentContext, tos []string, fromMent
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
// Set Message-ID on first message so replies know what to reference
- if ctx.Comment == nil {
+ if actName == "new" {
msg.SetHeader("Message-ID", "<"+ctx.Issue.ReplyReference()+">")
} else {
msg.SetHeader("In-Reply-To", "<"+ctx.Issue.ReplyReference()+">")
diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl
index 997e2447fc25e..d302a16f26c7e 100644
--- a/templates/mail/issue/assigned.tmpl
+++ b/templates/mail/issue/assigned.tmpl
@@ -1,17 +1,21 @@
+
{{.Subject}}
@{{.Doer.Name}} assigned you to the {{if .IsPull}}pull request{{else}}issue{{end}} #{{.Issue.Index}} in repository {{.Repo}}.
-
- ---
-
- View it on {{AppName}}.
-
-
+
diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl
index 71291c61bb511..aebad09cd3005 100644
--- a/templates/mail/issue/default.tmpl
+++ b/templates/mail/issue/default.tmpl
@@ -3,12 +3,15 @@
{{.Subject}}
- {{if .ReviewComments}}
+
- {{end}}
+
@@ -18,6 +21,8 @@
Closed #{{.Issue.Index}}.
{{else if eq .ActionName "reopen"}}
Reopened #{{.Issue.Index}}.
+ {{else if eq .ActionName "merge"}}
+ Merged #{{.Issue.Index}} into {{.Issue.PullRequest.BaseBranch}}.
{{else if eq .ActionName "approve"}}
@{{.Doer.Name}} approved this pull request.
{{else if eq .ActionName "reject"}}
@@ -42,10 +47,12 @@
{{end -}}
+