Skip to content

Commit 22521ab

Browse files
authored
Merge branch 'main' into #17249-fix-org-repo-count
2 parents fedc9e9 + cd0928f commit 22521ab

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

models/gpg_key_add.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,46 @@ func AddGPGKey(ownerID int64, content, token, signature string) ([]*GPGKey, erro
101101
verified = true
102102
}
103103

104+
if len(ekeys) > 1 {
105+
id2key := map[string]*openpgp.Entity{}
106+
newEKeys := make([]*openpgp.Entity, 0, len(ekeys))
107+
for _, ekey := range ekeys {
108+
id := ekey.PrimaryKey.KeyIdString()
109+
if original, has := id2key[id]; has {
110+
// Coalesce this with the other one
111+
for _, subkey := range ekey.Subkeys {
112+
if subkey.PublicKey == nil {
113+
continue
114+
}
115+
found := false
116+
117+
for _, originalSubkey := range original.Subkeys {
118+
if originalSubkey.PublicKey == nil {
119+
continue
120+
}
121+
if originalSubkey.PublicKey.KeyId == subkey.PublicKey.KeyId {
122+
found = true
123+
break
124+
}
125+
}
126+
if !found {
127+
original.Subkeys = append(original.Subkeys, subkey)
128+
}
129+
}
130+
for name, identity := range ekey.Identities {
131+
if _, has := original.Identities[name]; has {
132+
continue
133+
}
134+
original.Identities[name] = identity
135+
}
136+
continue
137+
}
138+
id2key[id] = ekey
139+
newEKeys = append(newEKeys, ekey)
140+
}
141+
ekeys = newEKeys
142+
}
143+
104144
for _, ekey := range ekeys {
105145
// Key ID cannot be duplicated.
106146
has, err := db.GetEngine(ctx).Where("key_id=?", ekey.PrimaryKey.KeyIdString()).

models/review.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content, comm
444444
// try to remove team review request if need
445445
if issue.Repo.Owner.IsOrganization() && (reviewType == ReviewTypeApprove || reviewType == ReviewTypeReject) {
446446
teamReviewRequests := make([]*Review, 0, 10)
447-
if err := sess.SQL("SELECT * FROM review WHERE reviewer_team_id > 0 AND type = ?", ReviewTypeRequest).Find(&teamReviewRequests); err != nil {
447+
if err := sess.SQL("SELECT * FROM review WHERE issue_id = ? AND reviewer_team_id > 0 AND type = ?", issue.ID, ReviewTypeRequest).Find(&teamReviewRequests); err != nil {
448448
return nil, nil, err
449449
}
450450

models/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func (u *User) CanImportLocal() bool {
300300
// DashboardLink returns the user dashboard page link.
301301
func (u *User) DashboardLink() string {
302302
if u.IsOrganization() {
303-
return u.OrganisationLink() + "/dashboard/"
303+
return u.OrganisationLink() + "/dashboard"
304304
}
305305
return setting.AppSubURL + "/"
306306
}

routers/web/repo/issue.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
327327
}
328328
return 0
329329
}
330+
331+
if ctx.Repo.CanWriteIssuesOrPulls(ctx.Params(":type") == "pulls") {
332+
projects, _, err := models.GetProjects(models.ProjectSearchOptions{
333+
RepoID: repo.ID,
334+
Type: models.ProjectTypeRepository,
335+
IsClosed: util.OptionalBoolOf(isShowClosed),
336+
})
337+
if err != nil {
338+
ctx.ServerError("GetProjects", err)
339+
return
340+
}
341+
ctx.Data["Projects"] = projects
342+
}
343+
330344
ctx.Data["IssueStats"] = issueStats
331345
ctx.Data["SelLabelIDs"] = labelIDs
332346
ctx.Data["SelectLabels"] = selectLabels

templates/repo/issue/list.tmpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,24 @@
166166
</div>
167167
</div>
168168

169+
<!-- Projects -->
170+
<div class="ui {{if not .Projects}}disabled{{end}} dropdown jump item">
171+
<span class="text">
172+
{{.i18n.Tr "repo.project_board"}}
173+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
174+
</span>
175+
<div class="menu">
176+
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects">
177+
{{.i18n.Tr "repo.issues.new.no_projects"}}
178+
</div>
179+
{{range .Projects}}
180+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
181+
{{.Title}}
182+
</div>
183+
{{end}}
184+
</div>
185+
</div>
186+
169187
<!-- Assignees -->
170188
<div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
171189
<span class="text">

0 commit comments

Comments
 (0)