From 0c927b1606a0c38c1016b1544b2f33635504e735 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 29 Jul 2019 11:29:42 +0800 Subject: [PATCH 1/7] change length of some repository's columns (#7652) --- models/migrations/migrations.go | 2 ++ models/migrations/v90.go | 18 ++++++++++++++++++ models/repo.go | 6 +++--- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 models/migrations/v90.go diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 62fadf5f361d0..5326022b41613 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -234,6 +234,8 @@ var migrations = []Migration{ NewMigration("add commit status context field to commit_status", addCommitStatusContext), // v89 -> v90 NewMigration("add original author/url migration info to issues, comments, and repo ", addOriginalMigrationInfo), + // v90 -> v91 + NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo), } // Migrate database to current version diff --git a/models/migrations/v90.go b/models/migrations/v90.go new file mode 100644 index 0000000000000..09aceae2f9e4a --- /dev/null +++ b/models/migrations/v90.go @@ -0,0 +1,18 @@ +// Copyright 2019 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. + +package migrations + +import "github.com/go-xorm/xorm" + +func changeSomeColumnsLengthOfRepo(x *xorm.Engine) error { + type Repository struct { + ID int64 `xorm:"pk autoincr"` + Description string `xorm:"TEXT"` + Website string `xorm:"VARCHAR(2048)"` + OriginalURL string `xorm:"VARCHAR(2048)"` + } + + return x.Sync2(new(Repository)) +} diff --git a/models/repo.go b/models/repo.go index ba14155395746..501a2c91207f5 100644 --- a/models/repo.go +++ b/models/repo.go @@ -134,9 +134,9 @@ type Repository struct { Owner *User `xorm:"-"` LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"` Name string `xorm:"INDEX NOT NULL"` - Description string - Website string - OriginalURL string + Description string `xorm:"TEXT"` + Website string `xorm:"VARCHAR(2048)"` + OriginalURL string `xorm:"VARCHAR(2048)"` DefaultBranch string NumWatches int From d02566a8ead1ef99ba354dbbbb45dcccaec54551 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Mon, 29 Jul 2019 06:15:18 +0200 Subject: [PATCH 2/7] integration tests: Use t.Helper() (#7654) --- integrations/html_helper.go | 1 + integrations/integration_test.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/integrations/html_helper.go b/integrations/html_helper.go index 139261d69424b..823ed44851532 100644 --- a/integrations/html_helper.go +++ b/integrations/html_helper.go @@ -19,6 +19,7 @@ type HTMLDoc struct { // NewHTMLParser parse html file func NewHTMLParser(t testing.TB, body *bytes.Buffer) *HTMLDoc { + t.Helper() doc, err := goquery.NewDocumentFromReader(body) assert.NoError(t, err) return &HTMLDoc{doc: doc} diff --git a/integrations/integration_test.go b/integrations/integration_test.go index e9b46ffcb9b9e..6597586e53c61 100644 --- a/integrations/integration_test.go +++ b/integrations/integration_test.go @@ -169,6 +169,7 @@ func initIntegrationTest() { } func prepareTestEnv(t testing.TB, skip ...int) { + t.Helper() ourSkip := 2 if len(skip) > 0 { ourSkip += skip[0] @@ -201,6 +202,7 @@ func (s *TestSession) GetCookie(name string) *http.Cookie { } func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.ResponseRecorder { + t.Helper() baseURL, err := url.Parse(setting.AppURL) assert.NoError(t, err) for _, c := range s.jar.Cookies(baseURL) { @@ -217,6 +219,7 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu } func (s *TestSession) MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder { + t.Helper() baseURL, err := url.Parse(setting.AppURL) assert.NoError(t, err) for _, c := range s.jar.Cookies(baseURL) { @@ -237,6 +240,7 @@ const userPassword = "password" var loginSessionCache = make(map[string]*TestSession, 10) func emptyTestSession(t testing.TB) *TestSession { + t.Helper() jar, err := cookiejar.New(nil) assert.NoError(t, err) @@ -244,6 +248,7 @@ func emptyTestSession(t testing.TB) *TestSession { } func loginUser(t testing.TB, userName string) *TestSession { + t.Helper() if session, ok := loginSessionCache[userName]; ok { return session } @@ -253,6 +258,7 @@ func loginUser(t testing.TB, userName string) *TestSession { } func loginUserWithPassword(t testing.TB, userName, password string) *TestSession { + t.Helper() req := NewRequest(t, "GET", "/user/login") resp := MakeRequest(t, req, http.StatusOK) @@ -278,6 +284,7 @@ func loginUserWithPassword(t testing.TB, userName, password string) *TestSession } func getTokenForLoggedInUser(t testing.TB, session *TestSession) string { + t.Helper() req := NewRequest(t, "GET", "/user/settings/applications") resp := session.MakeRequest(t, req, http.StatusOK) doc := NewHTMLParser(t, resp.Body) @@ -294,14 +301,17 @@ func getTokenForLoggedInUser(t testing.TB, session *TestSession) string { } func NewRequest(t testing.TB, method, urlStr string) *http.Request { + t.Helper() return NewRequestWithBody(t, method, urlStr, nil) } func NewRequestf(t testing.TB, method, urlFormat string, args ...interface{}) *http.Request { + t.Helper() return NewRequest(t, method, fmt.Sprintf(urlFormat, args...)) } func NewRequestWithValues(t testing.TB, method, urlStr string, values map[string]string) *http.Request { + t.Helper() urlValues := url.Values{} for key, value := range values { urlValues[key] = []string{value} @@ -312,6 +322,7 @@ func NewRequestWithValues(t testing.TB, method, urlStr string, values map[string } func NewRequestWithJSON(t testing.TB, method, urlStr string, v interface{}) *http.Request { + t.Helper() jsonBytes, err := json.Marshal(v) assert.NoError(t, err) req := NewRequestWithBody(t, method, urlStr, bytes.NewBuffer(jsonBytes)) @@ -320,6 +331,7 @@ func NewRequestWithJSON(t testing.TB, method, urlStr string, v interface{}) *htt } func NewRequestWithBody(t testing.TB, method, urlStr string, body io.Reader) *http.Request { + t.Helper() request, err := http.NewRequest(method, urlStr, body) assert.NoError(t, err) request.RequestURI = urlStr @@ -334,6 +346,7 @@ func AddBasicAuthHeader(request *http.Request, username string) *http.Request { const NoExpectedStatus = -1 func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.ResponseRecorder { + t.Helper() recorder := httptest.NewRecorder() mac.ServeHTTP(recorder, req) if expectedStatus != NoExpectedStatus { @@ -346,6 +359,7 @@ func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest. } func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder { + t.Helper() recorder := NewNilResponseRecorder() mac.ServeHTTP(recorder, req) if expectedStatus != NoExpectedStatus { @@ -359,6 +373,7 @@ func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedSta // logUnexpectedResponse logs the contents of an unexpected response. func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) { + t.Helper() respBytes := recorder.Body.Bytes() if len(respBytes) == 0 { return @@ -381,11 +396,13 @@ func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) { } func DecodeJSON(t testing.TB, resp *httptest.ResponseRecorder, v interface{}) { + t.Helper() decoder := json.NewDecoder(resp.Body) assert.NoError(t, decoder.Decode(v)) } func GetCSRF(t testing.TB, session *TestSession, urlStr string) string { + t.Helper() req := NewRequest(t, "GET", urlStr) resp := session.MakeRequest(t, req, http.StatusOK) doc := NewHTMLParser(t, resp.Body) From dd8a295efc79153d0853a331e9f274c55ce27bcf Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Mon, 29 Jul 2019 04:21:31 +0000 Subject: [PATCH 3/7] [skip ci] Updated translations via Crowdin --- options/locale/locale_ja-JP.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index c735cc621e72a..2575879bd980a 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -1407,6 +1407,7 @@ branch.restore_success=ブランチ '%s' を復元しました。 branch.restore_failed=ブランチ '%s' の復元に失敗しました。 branch.protected_deletion_failed=ブランチ '%s' は保護されています。 削除できません。 branch.restore=ブランチ '%s' の復元 +branch.download=ブランチ '%s' をダウンロード topic.manage_topics=トピックの管理 topic.done=完了 From 23e8cff08cf4e7012f8fb640df8b1ee26a239a8d Mon Sep 17 00:00:00 2001 From: 6543 <24977596+6543@users.noreply.github.com> Date: Mon, 29 Jul 2019 07:00:43 +0200 Subject: [PATCH 4/7] hide delete/restor button on archived repos (#7658) close issue #7653 --- templates/repo/branch/list.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 2b98881f60cf3..7ddd6f1f7f9bc 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -101,7 +101,7 @@ {{end}} - {{if and $.IsWriter (not $.IsMirror) (not .IsProtected)}} + {{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}} {{if .IsDeleted}} {{else}} From ed3d124552d0df2c364c4aaaab88f54c42167286 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Mon, 29 Jul 2019 08:14:56 +0200 Subject: [PATCH 5/7] css: use flex to fix floating paginate (#7656) --- public/css/index.css | 2 +- public/less/_repository.less | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/css/index.css b/public/css/index.css index 68236a6de919d..2eef059223287 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -756,7 +756,7 @@ footer .ui.left,footer .ui.right{line-height:40px} .repository .segment.reactions .select-reaction{float:none} .repository .segment.reactions .select-reaction:not(.active) a{display:none} .repository .segment.reactions:hover .select-reaction a{display:block} -.user-cards .list{padding:0} +.user-cards .list{padding:0;display:flex;flex-wrap:wrap} .user-cards .list .item{list-style:none;width:32%;margin:10px 10px 10px 0;padding-bottom:14px;float:left} .user-cards .list .item .avatar{width:48px;height:48px;float:left;display:block;margin-right:10px} .user-cards .list .item .name{margin-top:0;margin-bottom:0;font-weight:400} diff --git a/public/less/_repository.less b/public/less/_repository.less index 21aeea81e767c..8d2ca07d93164 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1971,6 +1971,8 @@ &.user-cards { .list { padding: 0; + display: flex; + flex-wrap: wrap; .item { list-style: none; From a94ae7acb00046c21d1071e151b4e66b16571b6a Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 29 Jul 2019 23:41:22 +0800 Subject: [PATCH 6/7] fix bug on migrating milestone from github (#7665) --- modules/migrations/gitea.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/migrations/gitea.go b/modules/migrations/gitea.go index 3320a8cb6d614..45f324516e8da 100644 --- a/modules/migrations/gitea.go +++ b/modules/migrations/gitea.go @@ -112,7 +112,7 @@ func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) err RepoID: g.repo.ID, Name: milestone.Title, Content: milestone.Description, - IsClosed: milestone.State == "close", + IsClosed: milestone.State == "closed", DeadlineUnix: deadline, } if ms.IsClosed && milestone.Closed != nil { From a957d4eeac4142e232896c22b45e63de6f21520f Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Mon, 29 Jul 2019 15:43:57 +0000 Subject: [PATCH 7/7] [skip ci] Updated translations via Crowdin --- options/locale/locale_es-ES.ini | 1 + options/locale/locale_fr-FR.ini | 3 +++ options/locale/locale_pt-BR.ini | 2 ++ 3 files changed, 6 insertions(+) diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index 2c7ef95faeaf9..359ddf86c0837 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -1407,6 +1407,7 @@ branch.restore_success=La rama '%s' ha sido restaurada. branch.restore_failed=Fallo al restaurar la rama %s. branch.protected_deletion_failed=La rama '%s' está protegida. No se puede eliminar. branch.restore=Restaurar rama '%s' +branch.download=Descargar rama '%s' topic.manage_topics=Administrar temas topic.done=Hecho diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index e163a7060a77f..4b61c5a55a59f 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -695,6 +695,7 @@ editor.delete=Supprimer '%s' editor.commit_message_desc=Ajouter une description détaillée facultative… editor.commit_directly_to_this_branch=Soumettre directement dans la branche %s. editor.create_new_branch=Créer une nouvelle branche pour cette révision et envoyer une nouvelle demande d'ajout. +editor.propose_file_change=Proposer une modification du fichier editor.new_branch_name_desc=Nouveau nom de la branche… editor.cancel=Annuler editor.filename_cannot_be_empty=Le nom de fichier ne peut être vide. @@ -1405,6 +1406,8 @@ branch.deleted_by=Supprimée par %s branch.restore_success=La branche "%s" a été restaurée. branch.restore_failed=La restauration de la branche '%s' a échoué. branch.protected_deletion_failed=La branche '%s' est protégé. Il ne peut pas être supprimé. +branch.restore=Restaurer la branche '%s' +branch.download=Télécharger la branche '%s' topic.manage_topics=Gérer les sujets topic.done=Terminé diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index b60e82149a05f..716aec22b6d0b 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -1406,6 +1406,8 @@ branch.deleted_by=Excluído por %s branch.restore_success=A branch '%s' foi restaurada. branch.restore_failed=Falha ao restaurar a branch %s. branch.protected_deletion_failed=A branch '%s' está protegida. Ela não pode ser excluída. +branch.restore=Restaurar branch '%s' +branch.download=Baixar branch '%s' topic.manage_topics=Gerenciar Tópicos topic.done=Feito