Skip to content

Commit 7781419

Browse files
author
Guillermo Prandi
committed
Merge branch 'master' into watchonchanges
2 parents ce99d45 + a957d4e commit 7781419

File tree

13 files changed

+53
-6
lines changed

13 files changed

+53
-6
lines changed

integrations/html_helper.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type HTMLDoc struct {
1919

2020
// NewHTMLParser parse html file
2121
func NewHTMLParser(t testing.TB, body *bytes.Buffer) *HTMLDoc {
22+
t.Helper()
2223
doc, err := goquery.NewDocumentFromReader(body)
2324
assert.NoError(t, err)
2425
return &HTMLDoc{doc: doc}

integrations/integration_test.go

+17
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ func initIntegrationTest() {
169169
}
170170

171171
func prepareTestEnv(t testing.TB, skip ...int) {
172+
t.Helper()
172173
ourSkip := 2
173174
if len(skip) > 0 {
174175
ourSkip += skip[0]
@@ -201,6 +202,7 @@ func (s *TestSession) GetCookie(name string) *http.Cookie {
201202
}
202203

203204
func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.ResponseRecorder {
205+
t.Helper()
204206
baseURL, err := url.Parse(setting.AppURL)
205207
assert.NoError(t, err)
206208
for _, c := range s.jar.Cookies(baseURL) {
@@ -217,6 +219,7 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu
217219
}
218220

219221
func (s *TestSession) MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder {
222+
t.Helper()
220223
baseURL, err := url.Parse(setting.AppURL)
221224
assert.NoError(t, err)
222225
for _, c := range s.jar.Cookies(baseURL) {
@@ -237,13 +240,15 @@ const userPassword = "password"
237240
var loginSessionCache = make(map[string]*TestSession, 10)
238241

239242
func emptyTestSession(t testing.TB) *TestSession {
243+
t.Helper()
240244
jar, err := cookiejar.New(nil)
241245
assert.NoError(t, err)
242246

243247
return &TestSession{jar: jar}
244248
}
245249

246250
func loginUser(t testing.TB, userName string) *TestSession {
251+
t.Helper()
247252
if session, ok := loginSessionCache[userName]; ok {
248253
return session
249254
}
@@ -253,6 +258,7 @@ func loginUser(t testing.TB, userName string) *TestSession {
253258
}
254259

255260
func loginUserWithPassword(t testing.TB, userName, password string) *TestSession {
261+
t.Helper()
256262
req := NewRequest(t, "GET", "/user/login")
257263
resp := MakeRequest(t, req, http.StatusOK)
258264

@@ -278,6 +284,7 @@ func loginUserWithPassword(t testing.TB, userName, password string) *TestSession
278284
}
279285

280286
func getTokenForLoggedInUser(t testing.TB, session *TestSession) string {
287+
t.Helper()
281288
req := NewRequest(t, "GET", "/user/settings/applications")
282289
resp := session.MakeRequest(t, req, http.StatusOK)
283290
doc := NewHTMLParser(t, resp.Body)
@@ -294,14 +301,17 @@ func getTokenForLoggedInUser(t testing.TB, session *TestSession) string {
294301
}
295302

296303
func NewRequest(t testing.TB, method, urlStr string) *http.Request {
304+
t.Helper()
297305
return NewRequestWithBody(t, method, urlStr, nil)
298306
}
299307

300308
func NewRequestf(t testing.TB, method, urlFormat string, args ...interface{}) *http.Request {
309+
t.Helper()
301310
return NewRequest(t, method, fmt.Sprintf(urlFormat, args...))
302311
}
303312

304313
func NewRequestWithValues(t testing.TB, method, urlStr string, values map[string]string) *http.Request {
314+
t.Helper()
305315
urlValues := url.Values{}
306316
for key, value := range values {
307317
urlValues[key] = []string{value}
@@ -312,6 +322,7 @@ func NewRequestWithValues(t testing.TB, method, urlStr string, values map[string
312322
}
313323

314324
func NewRequestWithJSON(t testing.TB, method, urlStr string, v interface{}) *http.Request {
325+
t.Helper()
315326
jsonBytes, err := json.Marshal(v)
316327
assert.NoError(t, err)
317328
req := NewRequestWithBody(t, method, urlStr, bytes.NewBuffer(jsonBytes))
@@ -320,6 +331,7 @@ func NewRequestWithJSON(t testing.TB, method, urlStr string, v interface{}) *htt
320331
}
321332

322333
func NewRequestWithBody(t testing.TB, method, urlStr string, body io.Reader) *http.Request {
334+
t.Helper()
323335
request, err := http.NewRequest(method, urlStr, body)
324336
assert.NoError(t, err)
325337
request.RequestURI = urlStr
@@ -334,6 +346,7 @@ func AddBasicAuthHeader(request *http.Request, username string) *http.Request {
334346
const NoExpectedStatus = -1
335347

336348
func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.ResponseRecorder {
349+
t.Helper()
337350
recorder := httptest.NewRecorder()
338351
mac.ServeHTTP(recorder, req)
339352
if expectedStatus != NoExpectedStatus {
@@ -346,6 +359,7 @@ func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.
346359
}
347360

348361
func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder {
362+
t.Helper()
349363
recorder := NewNilResponseRecorder()
350364
mac.ServeHTTP(recorder, req)
351365
if expectedStatus != NoExpectedStatus {
@@ -359,6 +373,7 @@ func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedSta
359373

360374
// logUnexpectedResponse logs the contents of an unexpected response.
361375
func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) {
376+
t.Helper()
362377
respBytes := recorder.Body.Bytes()
363378
if len(respBytes) == 0 {
364379
return
@@ -381,11 +396,13 @@ func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) {
381396
}
382397

383398
func DecodeJSON(t testing.TB, resp *httptest.ResponseRecorder, v interface{}) {
399+
t.Helper()
384400
decoder := json.NewDecoder(resp.Body)
385401
assert.NoError(t, decoder.Decode(v))
386402
}
387403

388404
func GetCSRF(t testing.TB, session *TestSession, urlStr string) string {
405+
t.Helper()
389406
req := NewRequest(t, "GET", urlStr)
390407
resp := session.MakeRequest(t, req, http.StatusOK)
391408
doc := NewHTMLParser(t, resp.Body)

models/migrations/migrations.go

+2
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ var migrations = []Migration{
234234
NewMigration("add commit status context field to commit_status", addCommitStatusContext),
235235
// v89 -> v90
236236
NewMigration("add original author/url migration info to issues, comments, and repo ", addOriginalMigrationInfo),
237+
// v90 -> v91
238+
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
237239
}
238240

239241
// Migrate database to current version

models/migrations/v90.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2019 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package migrations
6+
7+
import "github.com/go-xorm/xorm"
8+
9+
func changeSomeColumnsLengthOfRepo(x *xorm.Engine) error {
10+
type Repository struct {
11+
ID int64 `xorm:"pk autoincr"`
12+
Description string `xorm:"TEXT"`
13+
Website string `xorm:"VARCHAR(2048)"`
14+
OriginalURL string `xorm:"VARCHAR(2048)"`
15+
}
16+
17+
return x.Sync2(new(Repository))
18+
}

models/repo.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ type Repository struct {
134134
Owner *User `xorm:"-"`
135135
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
136136
Name string `xorm:"INDEX NOT NULL"`
137-
Description string
138-
Website string
139-
OriginalURL string
137+
Description string `xorm:"TEXT"`
138+
Website string `xorm:"VARCHAR(2048)"`
139+
OriginalURL string `xorm:"VARCHAR(2048)"`
140140
DefaultBranch string
141141

142142
NumWatches int

modules/migrations/gitea.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) err
112112
RepoID: g.repo.ID,
113113
Name: milestone.Title,
114114
Content: milestone.Description,
115-
IsClosed: milestone.State == "close",
115+
IsClosed: milestone.State == "closed",
116116
DeadlineUnix: deadline,
117117
}
118118
if ms.IsClosed && milestone.Closed != nil {

options/locale/locale_es-ES.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,7 @@ branch.restore_success=La rama '%s' ha sido restaurada.
14071407
branch.restore_failed=Fallo al restaurar la rama %s.
14081408
branch.protected_deletion_failed=La rama '%s' está protegida. No se puede eliminar.
14091409
branch.restore=Restaurar rama '%s'
1410+
branch.download=Descargar rama '%s'
14101411

14111412
topic.manage_topics=Administrar temas
14121413
topic.done=Hecho

options/locale/locale_fr-FR.ini

+3
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ editor.delete=Supprimer '%s'
695695
editor.commit_message_desc=Ajouter une description détaillée facultative…
696696
editor.commit_directly_to_this_branch=Soumettre directement dans la branche <strong class="branch-name">%s</strong>.
697697
editor.create_new_branch=Créer une <strong>nouvelle branche</strong> pour cette révision et envoyer une nouvelle demande d'ajout.
698+
editor.propose_file_change=Proposer une modification du fichier
698699
editor.new_branch_name_desc=Nouveau nom de la branche…
699700
editor.cancel=Annuler
700701
editor.filename_cannot_be_empty=Le nom de fichier ne peut être vide.
@@ -1405,6 +1406,8 @@ branch.deleted_by=Supprimée par %s
14051406
branch.restore_success=La branche "%s" a été restaurée.
14061407
branch.restore_failed=La restauration de la branche '%s' a échoué.
14071408
branch.protected_deletion_failed=La branche '%s' est protégé. Il ne peut pas être supprimé.
1409+
branch.restore=Restaurer la branche '%s'
1410+
branch.download=Télécharger la branche '%s'
14081411
14091412
topic.manage_topics=Gérer les sujets
14101413
topic.done=Terminé

options/locale/locale_ja-JP.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,7 @@ branch.restore_success=ブランチ '%s' を復元しました。
14071407
branch.restore_failed=ブランチ '%s' の復元に失敗しました。
14081408
branch.protected_deletion_failed=ブランチ '%s' は保護されています。 削除できません。
14091409
branch.restore=ブランチ '%s' の復元
1410+
branch.download=ブランチ '%s' をダウンロード
14101411

14111412
topic.manage_topics=トピックの管理
14121413
topic.done=完了

options/locale/locale_pt-BR.ini

+2
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,8 @@ branch.deleted_by=Excluído por %s
14061406
branch.restore_success=A branch '%s' foi restaurada.
14071407
branch.restore_failed=Falha ao restaurar a branch %s.
14081408
branch.protected_deletion_failed=A branch '%s' está protegida. Ela não pode ser excluída.
1409+
branch.restore=Restaurar branch '%s'
1410+
branch.download=Baixar branch '%s'
14091411

14101412
topic.manage_topics=Gerenciar Tópicos
14111413
topic.done=Feito

public/css/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ footer .ui.left,footer .ui.right{line-height:40px}
756756
.repository .segment.reactions .select-reaction{float:none}
757757
.repository .segment.reactions .select-reaction:not(.active) a{display:none}
758758
.repository .segment.reactions:hover .select-reaction a{display:block}
759-
.user-cards .list{padding:0}
759+
.user-cards .list{padding:0;display:flex;flex-wrap:wrap}
760760
.user-cards .list .item{list-style:none;width:32%;margin:10px 10px 10px 0;padding-bottom:14px;float:left}
761761
.user-cards .list .item .avatar{width:48px;height:48px;float:left;display:block;margin-right:10px}
762762
.user-cards .list .item .name{margin-top:0;margin-bottom:0;font-weight:400}

public/less/_repository.less

+2
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,8 @@
19711971
&.user-cards {
19721972
.list {
19731973
padding: 0;
1974+
display: flex;
1975+
flex-wrap: wrap;
19741976

19751977
.item {
19761978
list-style: none;

templates/repo/branch/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
</div>
102102
</div>
103103
{{end}}
104-
{{if and $.IsWriter (not $.IsMirror) (not .IsProtected)}}
104+
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}}
105105
{{if .IsDeleted}}
106106
<a class="ui basic jump button icon poping up undo-button" href data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID | urlquery}}&name={{.DeletedBranch.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.restore" (.Name | EscapePound)}}" data-variation="tiny inverted" data-position="top right"><i class="octicon octicon-reply text blue"></i></a>
107107
{{else}}

0 commit comments

Comments
 (0)