Skip to content

Commit 85d2668

Browse files
authored
Merge branch 'master' into 13682-review-requested-filter
2 parents 799cd8b + 872d308 commit 85d2668

File tree

19 files changed

+252
-72
lines changed

19 files changed

+252
-72
lines changed

models/issue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ func SearchIssueIDsByKeyword(kw string, repoIDs []int64, limit, start int) (int6
17171717
)
17181718

17191719
var ids = make([]int64, 0, limit)
1720-
err := x.Distinct("id").Table("issue").Where(cond).Limit(limit, start).Find(&ids)
1720+
err := x.Distinct("id").Table("issue").Where(cond).OrderBy("`updated_unix` DESC").Limit(limit, start).Find(&ids)
17211721
if err != nil {
17221722
return 0, nil, err
17231723
}

models/issue_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func TestIssue_SearchIssueIDsByKeyword(t *testing.T) {
299299
total, ids, err = SearchIssueIDsByKeyword("for", []int64{1}, 10, 0)
300300
assert.NoError(t, err)
301301
assert.EqualValues(t, 5, total)
302-
assert.EqualValues(t, []int64{1, 2, 3, 5, 11}, ids)
302+
assert.ElementsMatch(t, []int64{1, 2, 3, 5, 11}, ids)
303303

304304
// issue1's comment id 2
305305
total, ids, err = SearchIssueIDsByKeyword("good", []int64{1}, 10, 0)

models/project_board.go

+75-20
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"code.gitea.io/gitea/modules/setting"
99
"code.gitea.io/gitea/modules/timeutil"
1010

11+
"xorm.io/builder"
1112
"xorm.io/xorm"
1213
)
1314

@@ -164,45 +165,99 @@ func UpdateProjectBoard(board *ProjectBoard) error {
164165
func updateProjectBoard(e Engine, board *ProjectBoard) error {
165166
_, err := e.ID(board.ID).Cols(
166167
"title",
167-
"default",
168168
).Update(board)
169169
return err
170170
}
171171

172172
// GetProjectBoards fetches all boards related to a project
173-
func GetProjectBoards(projectID int64) ([]*ProjectBoard, error) {
173+
// if no default board set, first board is a temporary "Uncategorized" board
174+
func GetProjectBoards(projectID int64) (ProjectBoardList, error) {
175+
return getProjectBoards(x, projectID)
176+
}
174177

178+
func getProjectBoards(e Engine, projectID int64) ([]*ProjectBoard, error) {
175179
var boards = make([]*ProjectBoard, 0, 5)
176180

177-
sess := x.Where("project_id=?", projectID)
178-
return boards, sess.Find(&boards)
181+
if err := e.Where("project_id=? AND `default`=?", projectID, false).Find(&boards); err != nil {
182+
return nil, err
183+
}
184+
185+
defaultB, err := getDefaultBoard(e, projectID)
186+
if err != nil {
187+
return nil, err
188+
}
189+
190+
return append([]*ProjectBoard{defaultB}, boards...), nil
179191
}
180192

181-
// GetUncategorizedBoard represents a board for issues not assigned to one
182-
func GetUncategorizedBoard(projectID int64) (*ProjectBoard, error) {
193+
// getDefaultBoard return default board and create a dummy if none exist
194+
func getDefaultBoard(e Engine, projectID int64) (*ProjectBoard, error) {
195+
var board ProjectBoard
196+
exist, err := e.Where("project_id=? AND `default`=?", projectID, true).Get(&board)
197+
if err != nil {
198+
return nil, err
199+
}
200+
if exist {
201+
return &board, nil
202+
}
203+
204+
// represents a board for issues not assigned to one
183205
return &ProjectBoard{
184206
ProjectID: projectID,
185207
Title: "Uncategorized",
186208
Default: true,
187209
}, nil
188210
}
189211

212+
// SetDefaultBoard represents a board for issues not assigned to one
213+
// if boardID is 0 unset default
214+
func SetDefaultBoard(projectID, boardID int64) error {
215+
sess := x
216+
217+
_, err := sess.Where(builder.Eq{
218+
"project_id": projectID,
219+
"`default`": true,
220+
}).Cols("`default`").Update(&ProjectBoard{Default: false})
221+
if err != nil {
222+
return err
223+
}
224+
225+
if boardID > 0 {
226+
_, err = sess.ID(boardID).Where(builder.Eq{"project_id": projectID}).
227+
Cols("`default`").Update(&ProjectBoard{Default: true})
228+
}
229+
230+
return err
231+
}
232+
190233
// LoadIssues load issues assigned to this board
191234
func (b *ProjectBoard) LoadIssues() (IssueList, error) {
192-
var boardID int64
193-
if !b.Default {
194-
boardID = b.ID
195-
196-
} else {
197-
// Issues without ProjectBoardID
198-
boardID = -1
199-
}
200-
issues, err := Issues(&IssuesOptions{
201-
ProjectBoardID: boardID,
202-
ProjectID: b.ProjectID,
203-
})
204-
b.Issues = issues
205-
return issues, err
235+
issueList := make([]*Issue, 0, 10)
236+
237+
if b.ID != 0 {
238+
issues, err := Issues(&IssuesOptions{
239+
ProjectBoardID: b.ID,
240+
ProjectID: b.ProjectID,
241+
})
242+
if err != nil {
243+
return nil, err
244+
}
245+
issueList = issues
246+
}
247+
248+
if b.Default {
249+
issues, err := Issues(&IssuesOptions{
250+
ProjectBoardID: -1, // Issues without ProjectBoardID
251+
ProjectID: b.ProjectID,
252+
})
253+
if err != nil {
254+
return nil, err
255+
}
256+
issueList = append(issueList, issues...)
257+
}
258+
259+
b.Issues = issueList
260+
return issueList, nil
206261
}
207262

208263
// LoadIssues load issues assigned to the boards

modules/indexer/issues/bleve.go

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ func (b *BleveIndexer) Search(keyword string, repoIDs []int64, limit, start int)
247247
newMatchPhraseQuery(keyword, "Comments", issueIndexerAnalyzer),
248248
))
249249
search := bleve.NewSearchRequestOptions(indexerQuery, limit, start, false)
250+
search.SortBy([]string{"-_score"})
250251

251252
result, err := b.indexer.Search(search)
252253
if err != nil {

modules/indexer/issues/elastic_search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (b *ElasticSearchIndexer) Search(keyword string, repoIDs []int64, limit, st
205205
searchResult, err := b.client.Search().
206206
Index(b.indexerName).
207207
Query(query).
208-
Sort("id", true).
208+
Sort("_score", false).
209209
From(start).Size(limit).
210210
Do(context.Background())
211211
if err != nil {

modules/indexer/issues/indexer_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestBleveSearchIssues(t *testing.T) {
6565

6666
ids, err = SearchIssuesByKeyword([]int64{1}, "for")
6767
assert.NoError(t, err)
68-
assert.EqualValues(t, []int64{1, 2, 3, 5, 11}, ids)
68+
assert.ElementsMatch(t, []int64{1, 2, 3, 5, 11}, ids)
6969

7070
ids, err = SearchIssuesByKeyword([]int64{1}, "good")
7171
assert.NoError(t, err)
@@ -89,7 +89,7 @@ func TestDBSearchIssues(t *testing.T) {
8989

9090
ids, err = SearchIssuesByKeyword([]int64{1}, "for")
9191
assert.NoError(t, err)
92-
assert.EqualValues(t, []int64{1, 2, 3, 5, 11}, ids)
92+
assert.ElementsMatch(t, []int64{1, 2, 3, 5, 11}, ids)
9393

9494
ids, err = SearchIssuesByKeyword([]int64{1}, "good")
9595
assert.NoError(t, err)

options/locale/locale_en-US.ini

+2
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,8 @@ projects.board.edit_title = "New Board Name"
945945
projects.board.new_title = "New Board Name"
946946
projects.board.new_submit = "Submit"
947947
projects.board.new = "New Board"
948+
projects.board.set_default = "Set Default"
949+
projects.board.set_default_desc = "Set this board as default for uncategorized issues and pulls"
948950
projects.board.delete = "Delete Board"
949951
projects.board.deletion_desc = "Deleting a project board moves all related issues to 'Uncategorized'. Continue?"
950952
projects.open = Open

options/locale/locale_ja-JP.ini

+9
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ password_not_match=パスワードが一致しません。
358358
lang_select_error=言語をリストから選択してください。
359359

360360
username_been_taken=ユーザー名が既に使用されています。
361+
username_change_not_local_user=非ローカルユーザーのユーザー名は変更できません。
361362
repo_name_been_taken=リポジトリ名が既に使用されています。
362363
repository_files_already_exist=このリポジトリのファイルはすでに存在します。システム管理者に問い合わせてください。
363364
repository_files_already_exist.adopt=このリポジトリのファイルはすでに存在しており、それらを登録することしかできません。
@@ -821,6 +822,8 @@ tag=タグ
821822
released_this=がこれをリリース
822823
file_raw=Raw
823824
file_history=履歴
825+
file_view_source=ソースを表示
826+
file_view_rendered=レンダリング表示
824827
file_view_raw=Rawデータを見る
825828
file_permalink=パーマリンク
826829
file_too_large=このファイルは大きすぎるため、表示できません。
@@ -1997,6 +2000,7 @@ dashboard=ダッシュボード
19972000
users=ユーザーアカウント
19982001
organizations=組織
19992002
repositories=リポジトリ
2003+
hooks=Webhook
20002004
authentication=認証ソース
20012005
emails=ユーザーメールアドレス
20022006
config=設定
@@ -2146,8 +2150,13 @@ repos.forks=フォーク
21462150
repos.issues=課題
21472151
repos.size=サイズ
21482152

2153+
defaulthooks=デフォルトWebhook
2154+
defaulthooks.desc=Webhookは、特定のGiteaイベントトリガーが発生した際に、自動的にHTTP POSTリクエストをサーバーへ送信するものです。 ここで定義されたWebhookはデフォルトとなり、全ての新規リポジトリにコピーされます。 詳しくは<a target="_blank" rel="noopener" href="https://docs.gitea.io/en-us/webhooks/">webhooks guide</a>をご覧下さい。
2155+
defaulthooks.add_webhook=デフォルトWebhookの追加
2156+
defaulthooks.update_webhook=デフォルトWebhookの更新
21492157

21502158
systemhooks=システムWebhook
2159+
systemhooks.desc=Webhookは、特定のGiteaイベントトリガーが発生した際に、自動的にHTTP POSTリクエストをサーバーへ送信するものです。 ここで定義したWebhookはシステム内のすべてのリポジトリで呼び出されます。 そのため、パフォーマンスに及ぼす影響を考慮したうえで設定してください。 詳しくは<a target="_blank" rel="noopener" href="https://docs.gitea.io/en-us/webhooks/">webhooks guide</a>をご覧下さい。
21512160
systemhooks.add_webhook=システムWebhookを追加
21522161
systemhooks.update_webhook=システムWebhookを更新
21532162

options/locale/locale_tr-TR.ini

+15-2
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ password_not_match=Parolalar uyuşmuyor.
358358
lang_select_error=Listeden bir dil seçin.
359359

360360
username_been_taken=Bu kullanıcı adı daha önce alınmış.
361+
username_change_not_local_user=Yerel olmayan kullanıcılar kendi kullanıcı adlarını değiştiremezler.
361362
repo_name_been_taken=Depo adı zaten kullanılıyor.
362363
repository_files_already_exist=Bu depo için dosyalar zaten var. Sistem yöneticisine başvurun.
363364
repository_files_already_exist.adopt=Bu depo için dosyalar zaten var ve yalnızca Kabul Edilebilir.
@@ -821,6 +822,8 @@ tag=Etiket
821822
released_this=bu sürümü yayınladı
822823
file_raw=Ham
823824
file_history=Geçmiş
825+
file_view_source=Kaynağı Görüntüle
826+
file_view_rendered=Oluşturulanları Görüntüle
824827
file_view_raw=Ham Görünüm
825828
file_permalink=Kalıcı Bağlantı
826829
file_too_large=Bu dosya görüntülemek için çok büyük.
@@ -941,6 +944,8 @@ projects.board.edit_title=Yeni Pano Adı
941944
projects.board.new_title=Yeni Pano Adı
942945
projects.board.new_submit=Gönder
943946
projects.board.new=Yeni Pano
947+
projects.board.set_default=Varsayılana Ayarla
948+
projects.board.set_default_desc=Kategorize edilmemiş konular ve çekme istekleri için bu panoyu varsayılan olarak ayarlayın
944949
projects.board.delete=Panoyu Sil
945950
projects.board.deletion_desc=Bir proje panosunun silinmesi, ilgili tüm konuları 'Kategorize edilmemiş'e taşır. Devam edilsin mi?
946951
projects.open=Aç
@@ -1482,7 +1487,7 @@ settings.use_external_issue_tracker=Harici Konu İzleyici Kullan
14821487
settings.external_tracker_url=Harici Konu İzleyici URLsi
14831488
settings.external_tracker_url_error=Harici konu izleyici URL'si geçerli bir URL değil.
14841489
settings.external_tracker_url_desc=Ziyaretçiler, konular sekmesine tıkladığında harici konu izleyici URL'sine yönlendirilir.
1485-
settings.tracker_url_format=Harici Sorun Takipçisi Bağlantı Formatı
1490+
settings.tracker_url_format=Harici Konu İzleyici URL Biçimi
14861491
settings.tracker_url_format_error=Harici konu izleyici URL biçimi geçerli bir URL değil.
14871492
settings.tracker_issue_style=Harici Konu İzleyici Numara Biçimi
14881493
settings.tracker_issue_style.numeric=Sayısal
@@ -1997,6 +2002,7 @@ dashboard=Pano
19972002
users=Kullanıcı Hesapları
19982003
organizations=Organizasyonlar
19992004
repositories=Depolar
2005+
hooks=Web İstemcileri
20002006
authentication=Yetkilendirme Kaynakları
20012007
emails=Kullanıcı E-postaları
20022008
config=Yapılandırma
@@ -2084,7 +2090,7 @@ users.full_name=Tam İsim
20842090
users.activated=Aktifleştirilmiş
20852091
users.admin=Yönetici
20862092
users.restricted=Kısıtlanmış
2087-
users.2fa=2ED
2093+
users.2fa=2FD
20882094
users.repos=Depolar
20892095
users.created=Oluşturuldu
20902096
users.last_login=Son Oturum Açma
@@ -2113,6 +2119,7 @@ users.delete_account=Kullanıcı Hesabını Sil
21132119
users.still_own_repo=Bu kullanıcı hala bir veya daha fazla depoya sahip. Önce bu depoları silin veya transfer edin.
21142120
users.still_has_org=Bu kullanıcı bir organizasyonun üyesidir. Önce kullanıcıyı tüm organizasyonlardan çıkarın.
21152121
users.deletion_success=Kullanıcı hesabı silindi.
2122+
users.reset_2fa=2FD'yi sıfırla
21162123
21172124
emails.email_manage_panel=Kullanıcı E-posta Yönetimi
21182125
emails.primary=Birincil
@@ -2145,8 +2152,13 @@ repos.forks=Çatallar
21452152
repos.issues=Konular
21462153
repos.size=Boyut
21472154
2155+
defaulthooks=Varsayılan Web İstemcileri
2156+
defaulthooks.desc=Web İstemcileri, belirli Gitea olayları tetiklendiğinde otomatik olarak HTTP POST isteklerini sunucuya yapar. Burada tanımlanan Web İstemcileri varsayılandır ve tüm yeni depolara kopyalanır. <a target="_blank" rel="noopener" href="https://docs.gitea.io/en-us/webhooks/">web istemcileri kılavuzunda</a> daha fazla bilgi edinin.
2157+
defaulthooks.add_webhook=Varsayılan Web İstemcisi Ekle
2158+
defaulthooks.update_webhook=Varsayılan Web İstemcisini Güncelle
21482159
21492160
systemhooks=Sistem Web İstemcileri
2161+
systemhooks.desc=Belirli Gitea olayları tetiklendiğinde Web istemcileri otomatik olarak bir sunucuya HTTP POST istekleri yapar. Burada tanımlanan web istemcileri sistemdeki tüm depolar üzerinde çalışır, bu yüzden lütfen bunun olabilecek tüm performans sonuçlarını göz önünde bulundurun. <a target="_blank" rel="noopener" href="https://docs.gitea.io/en-us/webhooks/">web istemcileri kılavuzunda</a> daha fazla bilgi edinin.
21502162
systemhooks.add_webhook=Sistem Web İstemcisi Ekle
21512163
systemhooks.update_webhook=Sistem Web İstemcisi Güncelle
21522164
@@ -2489,6 +2501,7 @@ mirror_sync_delete=<a href="%[1]s">%[3]s</a> adresindeki <code>%[2]s</code> refe
24892501
approve_pull_request=`<a href="%s/pulls/%s">%s#%[2]s</a> onaylandı`
24902502
reject_pull_request=`<a href="%s/pulls/%s">%s#%[2]s</a> için değişiklik önerdi `
24912503
publish_release=` <a href="%[1]s">%[3]s</a> deposunda <a href="%s/releases/tag/%s"> "%[4]s" </a> sürümü yayınlandı`
2504+
create_branch=<a href="%[1]s/src/branch/%[2]s">%[3]s</a> dalını <a href="%[1]s">%[4]s</a> içinde oluşturdu
24922505
24932506
[tool]
24942507
ago=%s önce

options/locale/locale_zh-TW.ini

+8
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,8 @@ projects.board.edit_title=新看板名稱
943943
projects.board.new_title=新看板名稱
944944
projects.board.new_submit=送出
945945
projects.board.new=新增看板
946+
projects.board.set_default=設為預設
947+
projects.board.set_default_desc=將此看板設定為未分類問題及合併請求的預設看板
946948
projects.board.delete=刪除看板
947949
projects.board.deletion_desc=刪除專案看板會將相關的問題移動到 '未分類'。是否繼續?
948950
projects.open=開啟
@@ -1999,6 +2001,7 @@ dashboard=資訊主頁
19992001
users=使用者帳戶
20002002
organizations=組織
20012003
repositories=儲存庫
2004+
hooks=Webhook
20022005
authentication=認證來源
20032006
emails=使用者電子信箱
20042007
config=組態
@@ -2148,8 +2151,13 @@ repos.forks=Fork 數
21482151
repos.issues=問題數
21492152
repos.size=大小
21502153

2154+
defaulthooks=預設 Webhook
2155+
defaulthooks.desc=當觸發某些 Gitea 事件時,Webhook 會自動發出 HTTP POST 請求到指定的伺服器。這裡所定義的 Webhook 是預設的,並且會複製到所有新儲存庫。在 <a target="_blank" rel="noopener" href="https://docs.gitea.io/en-us/webhooks/">Webhook 指南</a>閱讀更多內容。
2156+
defaulthooks.add_webhook=新增預設 Webhook
2157+
defaulthooks.update_webhook=更新預設 Webhook
21512158

21522159
systemhooks=系統 Webhook
2160+
systemhooks.desc=當觸發某些 Gitea 事件時,Webhook 會自動發出 HTTP POST 請求到指定的伺服器。由於這裡所定義的 Webhook 會影響此系統上的所有儲存庫,因此請評估這會對效能造成多少影響。在 <a target="_blank" rel="noopener" href="https://docs.gitea.io/en-us/webhooks/">Webhook 指南</a>閱讀更多內容。
21532161
systemhooks.add_webhook=新增系統 Webhook
21542162
systemhooks.update_webhook=更新系統 Webhook
21552163

routers/api/v1/api.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ func RegisterRoutes(m *macaron.Macaron) {
640640
m.Group("/:username/:reponame", func() {
641641
m.Combo("").Get(reqAnyRepoReader(), repo.Get).
642642
Delete(reqToken(), reqOwner(), repo.Delete).
643-
Patch(reqToken(), reqAdmin(), bind(api.EditRepoOption{}), context.RepoRefForAPI(), repo.Edit)
643+
Patch(reqToken(), reqAdmin(), context.RepoRefForAPI(), bind(api.EditRepoOption{}), repo.Edit)
644644
m.Post("/transfer", reqOwner(), bind(api.TransferRepoOption{}), repo.Transfer)
645645
m.Combo("/notifications").
646646
Get(reqToken(), notify.ListRepoNotifications).
@@ -713,8 +713,8 @@ func RegisterRoutes(m *macaron.Macaron) {
713713
Delete(reqToken(), repo.DeleteIssueComment)
714714
m.Combo("/reactions").
715715
Get(repo.GetIssueCommentReactions).
716-
Post(bind(api.EditReactionOption{}), reqToken(), repo.PostIssueCommentReaction).
717-
Delete(bind(api.EditReactionOption{}), reqToken(), repo.DeleteIssueCommentReaction)
716+
Post(reqToken(), bind(api.EditReactionOption{}), repo.PostIssueCommentReaction).
717+
Delete(reqToken(), bind(api.EditReactionOption{}), repo.DeleteIssueCommentReaction)
718718
})
719719
})
720720
m.Group("/:index", func() {
@@ -754,8 +754,8 @@ func RegisterRoutes(m *macaron.Macaron) {
754754
})
755755
m.Combo("/reactions").
756756
Get(repo.GetIssueReactions).
757-
Post(bind(api.EditReactionOption{}), reqToken(), repo.PostIssueReaction).
758-
Delete(bind(api.EditReactionOption{}), reqToken(), repo.DeleteIssueReaction)
757+
Post(reqToken(), bind(api.EditReactionOption{}), repo.PostIssueReaction).
758+
Delete(reqToken(), bind(api.EditReactionOption{}), repo.DeleteIssueReaction)
759759
})
760760
}, mustEnableIssuesOrPulls)
761761
m.Group("/labels", func() {

0 commit comments

Comments
 (0)