Compare commits

...

109 Commits

Author SHA1 Message Date
4d876ab1c8
Changelog for v1.10.6 (#10699)
* Changelog for v1.10.6

* Add warnning

* Apply suggestions from code review

Co-Authored-By: John Olheiser <john.olheiser@gmail.com>

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-03-10 17:09:54 +00:00
f58715d903
cross compile using go 1.13.x (#10684) (#10696)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-03-10 16:25:59 +01:00
81072af8ce
add changelog for v1.10.5 (#10628) 2020-03-06 06:34:28 +00:00
guillep2k
1d7a855d66
Fix migration bug on v96.go (#10572) (#10574)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-03-02 10:32:38 -06:00
zeripath
3c8842d58c
v1.10.4 Changelog (#10294)
* v1.10.4 Changelog

* Add backport identifier for #10261

* Update CHANGELOG.md entry for #9884

* Workaround docker-library/postgres#658

* Update .drone.yml
2020-02-16 22:45:38 +02:00
e786f098d5
Fix reply on code review (#10261)
* Fix branch page pull request title and link error (#10092)

* Fix branch page pull request title and link error

* Fix ui

* Fix reply on code review (#10227)

Co-authored-by: zeripath <art27@cantab.net>

* Revert unrelated change

* Fix lint

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-02-14 13:53:36 +02:00
22dec1cea6
Fix branch page pull request title and link error (#10092) (#10098)
* Fix branch page pull request title and link error (#10092)
* Fix tmpl
2020-02-01 17:37:52 +00:00
0c5e2e2e4c
Fix milestone API state parameter unhandled (#10049) (#10053)
* Fix milestone API state parameter unhandled (#10049)

* Fix milestone API state parameter unhandled

* Fix test

* Fix test
2020-01-30 11:49:02 +08:00
158b716387 Fix wiki raw view on sub path (#10002) (#10041)
* Fix wiki raw view on sub path

* Add test for subpath wiki raw file

* Fix bug

Co-authored-by: zeripath <art27@cantab.net>
2020-01-28 15:10:40 +00:00
John Olheiser
e611dbbe86 Fix RocketChat (#9925)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-01-22 10:07:11 +02:00
dioss-Machiel
68bca621cd Prevent empty LDAP search from deactivating all users (#9879) (#9890)
* Backport of #9879 (Add option to prevent LDAP from deactivating everything on empty search)

* go fmtted

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
2020-01-20 15:02:35 -05:00
c4e0f717e7 fix bug about wrong dependencies permissions check and other wr… (#9884)
* fix bug about wrong dependencies permissions check and other wrong permissions check

* improve code
2020-01-20 16:45:42 +01:00
zeripath
e3e024876e Ensure that 2fa is checked on reset-password (#9857) (#9877)
* Ensure that 2fa is checked on reset-password

* Apply suggestions from code review

Co-Authored-By: Lauris BH <lauris@nix.lv>

* Properly manage scratch_code regeneration

Co-authored-by: Lauris BH <lauris@nix.lv>

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-19 18:37:28 -05:00
6543
cebc125f7f Changelog 1.10.3 (#9832) 2020-01-17 16:18:34 -05:00
6543
c975287149 fix (#9838) 2020-01-17 23:25:46 +08:00
b31068652a Fix download file wrong content-type (#9825) (#9835)
* Fix download file wrong content-type

* change the error text to be more precise

* fix test

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-17 14:56:25 +01:00
918e640590 Fix wrong identify poster on a migrated pull request when submi… (#9827) (#9831) 2020-01-17 13:38:53 +01:00
9809fe27c4 fix dump non-exist log directory (#9818) (#9820)
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-17 08:51:21 +01:00
ed6a2f2e2e
Fix compare (#9808) (#9815)
Co-authored-by: techknowlogick <matti@mdranta.net>

Co-authored-by: techknowlogick <matti@mdranta.net>
2020-01-17 10:08:07 +08:00
a0435fcd63 Fix missing msteam webhook on organization (#9781) (#9795) 2020-01-16 07:36:05 +02:00
David Svantesson
a2e2045a96 Fix #9662 (#9783) 2020-01-16 01:26:55 +01:00
Lauris BH
b67a023bec Send tag create and push webhook when release created on UI (#8671) (#9702)
* 'update'

* Send push tag event when release created

* send tag create event while release created in UI

* update to go v1.13

* fix gofmt error

* update #8671 move release tag created hook to modules/notification/webhook due to #8802 refactoring

* use NotifyCreateRef and NotifyPushCommits instead of NotifyNewReleaseTag

* move tag notification to correct place

Co-authored-by: Benno <blueworrybear@gmail.com>
2020-01-13 07:09:13 +00:00
Lauris BH
b1a90f7286
Hide credentials when submitting migration (#9102) (#9704)
through API.
Same fix, using form.CloneAddr instead of opts.CloneAddr.

Co-authored-by: Jordan <eatsleepgame@gmail.com>
2020-01-11 17:25:16 +02:00
Lauris BH
45c8a3aeeb
Fix cache problem on dashboard (#9358) (#9703)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-11 16:23:40 +02:00
zeripath
0e5126da22 Never allow an empty password to validate (#9682) (#9684)
* Restore IsPasswordSet previous value

* Update models/user.go
2020-01-11 13:14:03 +02:00
zeripath
cd3e52d91b Prevent redirect to Host (#9678) (#9680) 2020-01-09 16:38:12 -05:00
zeripath
319c92163f Branches not at ref commit ID should not be listed as Merged (#9614) (#9639)
Once a branch has been merged if the commit ID no longer equals that of
the pulls ref commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.

Fix #9201

When looking at the pull page we should also get the commits from the refs/pulls/x/head

Fix #9158
2020-01-08 03:06:53 +02:00
6543
a15a644c05 [BugFix] Hide public repos owned by private orgs (#9616) 2020-01-06 10:12:55 +08:00
6543
2ccd92407a Changelog for 1.10.2 (#9585)
* Changelog for 1.10.2

* imprufe

* fix misspell

* Update CHANGELOG.md
2020-01-02 19:04:19 +08:00
6543
17c691f8aa [Backport] [API] Allow only specific Colums to be updated on Issue (#9539) (#9580)
* 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

* add Test for IssueEdit

* load milestone and return it on IssueEdit via API

* extend Test for TestAPIEditIssue

* fix TEST

* make sure Poster is loaded

* keep code format on backport as it is
2020-01-02 02:38:42 -05:00
6543
cb3fe4cbf1 [Backport] Fix bug when migrate from API (#8631) (#9563)
* Fix bug when migrate from API (#8631)

* fix bug when migrate from API

* fix test

* fix test

* improve

* fix error message

* Update routers/api/v1/repo/repo.go

* remove unrelated

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-02 01:36:00 +02:00
6543
c63a80138a backport part of #9550 (#9564)
* add ErrReactionAlreadyExist
 * extend FindReactionsOptions
 * createReaction check if exit before create
2019-12-31 19:00:17 +02:00
6543
b4b8c9679f fix 500 error for ghost avatar (#9537) 2019-12-30 18:55:51 +08:00
c0bb5ebc15 Fix repository issues pagination bug when there are more than one label filter (#9512) (#9528)
* Fix repository issues pagination bug when there are more than one label filter (#9512)

* fix merge
2019-12-28 23:54:24 +00:00
9409ac9030
Fix deleted branch isn't removed when push the branch again (#9516) (#9524) 2019-12-28 12:41:41 +08:00
a3928fd820 Fix missing repository status when migrating repository via API (#9511)
* Fix API migration wrong repository status

* Force push for ci
2019-12-27 14:34:28 +02:00
Brad Albright
f0bda12c49 when branch is deleted after a pull request is merged, trigger webhook (#9510) 2019-12-27 14:36:52 +08:00
Brad Albright
58c38ab4b6 backport fix: fixed bug in GitTreeBySHA where pulling items from a page other than page 1 would fail because the wrong var was used to set the entries to return (#9482) 2019-12-24 07:01:02 +00:00
John Olheiser
a276aaf61e Fix NewCommitStatus (#9434) (#9435)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-12-19 23:49:47 +01:00
mrsdizzie
e03934f035 Use OriginalURL insead of CloneAddr in migration logging (#9418) (#9420)
CloneAddr will contain username and password credentials and they will
get stored in system notices about failed migrations (and logs if trace
is set). Replace with OriginalURL that doesn't have those.
2019-12-18 21:02:47 -05:00
Cornel
3a14a69e8a Fix Slack webhook payload title generation to work with Mattermost (#9378) (#9404) 2019-12-18 20:56:35 +08:00
zeripath
f0f48e0fff
DefaultBranch needs to be prefixed by BranchPrefix (#9356) (#9359) 2019-12-15 11:08:19 +00:00
1aeeaa8e89
fix issue indexer not triggered when migrating a repository (#9333) 2019-12-13 13:07:11 +08:00
eb8d5f6aff
Fix bug that release attachment files not deleted when deleting repository (#9322) (#9329)
* Fix bug that release attachment files not deleted when deleting repository

* improve code

* add quote

* improve code
2019-12-12 15:05:44 +08:00
John Olheiser
9ef148abeb Fix migration releases (#9319) (#9326) (#9328)
* Only sync tags after all batches (#9319)

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add SyncTags to uploader interface (#9326)

* Add sync tags to interface

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix revive

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-12-11 23:38:58 -05:00
6543
f11df80058 File Edit: Author/Committer interchanged [BugFix] (#9300) 2019-12-09 21:12:36 +08:00
6543
59913f405c Changelog 1.10.1 (#9256)
* Changelog for 1.10.1

* format ...

* format

* add @techknowlogick s suggestion
2019-12-05 13:23:51 -05:00
6543
42dae399eb Fix max length check and limit in multiple repo forms (#9148) (#9204)
* Fix input field max length for release, label and milestone forms

* Add max length for isseu and PR title
2019-11-29 14:00:19 +08:00
6543
f36efe0b54 Properly fix displaying virtual session provider in admin panel (#9137) (#9203)
* Properly fix #7147

Although #7300 properly shadows the password from the virtual session
provider, the template displaying the provider config still presumed
that the config was JSON.

This PR updates the template and properly hides the Virtual Session
provider.

Fixes #7147

* update per @silverwind's suggestion
2019-11-29 00:28:38 -05:00
38664d7f39 upgrade levelqueue to 0.1.0 (#9192) (#9199) 2019-11-28 17:40:49 +01:00
c4e52d232e Fix panic when diff (#9187) (#9193)
* fix panic when diff

* improve code
2019-11-28 10:07:30 -05:00
zeripath
2b257a91de Fix #9151 - smtp logger configuration sendTos should be an arra… (#9157)
* Fix #9151 - sendTos should be an array

* trimspace from the addresses
2019-11-25 16:18:16 +01:00
Benno
c01afd584d backport v1.10 - Always show Password field on link account sign in page (#9150) 2019-11-24 18:38:05 -05:00
guillep2k
1270e2ad85 Create PR on Current Repository by Default (#8670) (#9141)
* 'update'

* Send push tag event when release created

* send tag create event while release created in UI

* update to go v1.13

* fix gofmt error

* fix #8576 create pull request on current repository by default
2019-11-24 03:08:40 +01:00
29fa3a0f68 fix race on indexer (#9136) (#9139) 2019-11-23 20:08:49 +02:00
Koichi MATSUMOTO
65a573f3c7 Fix reCAPTCHA URL (#9119)
Fix reCAPTCHA issue
2019-11-22 14:48:58 +00:00
Jordan
ade5ec5aa7 Backport: Hide given credentials for migrated repos. (#9098)
CloneAddr was being used as OriginalURL.
Now passing OriginalURL through from the form and saving it.
2019-11-20 17:23:12 -05:00
techknowlogick
38ce87a61a
backport: update golang.org/x/crypto vendor to use acme v2 (#9056) (#9085) 2019-11-20 02:12:47 -05:00
guillep2k
261b19ced7 Backport: Fix password checks on admin create/edit user (#9076) (#9081)
* Fix password checks on admin create/edit user

* Remove incorrect trimspace
2019-11-20 00:08:53 +00:00
Antoine GIRARD
6ef0ab4d96 fix: add search to reserved usernames (#9063) (#9065)
* fix: add search to reserved usernames

* Update integrations/user_test.go

Co-Authored-By: 6543 <24977596+6543@users.noreply.github.com>
2019-11-18 22:40:14 +00:00
guillep2k
ecdb4c1750 Fix permission checks for close/reopen from commit (#8875) (#9033)
* Fix checks for close/reopen from commit

* Fix permission order
2019-11-16 00:11:40 +02:00
zeripath
a0e76de75a
Ensure Written is set in GZIP ProxyResponseWriter (#9018) (#9025)
Fix #9001

The GZIP ProxyReponseWriter doesn't currently respond correctly
to requests about its Written status - leading to #9001.

This PR properly reimplements these methods.
2019-11-15 15:57:57 +00:00
6543
880f26c7f0 Fix broken link to branch from issue list (#9003) (#9021)
* Fix broken link to branch from issue list

* Update templates/repo/issue/list.tmpl
2019-11-15 14:10:28 +00:00
fd461ca555
fix wrong system notice when repository is empty (#9020) 2019-11-15 20:13:58 +08:00
zeripath
3487fb66a1
Shadow password correctly for session config (#8984) (#9002)
Fix #8718

This PR shadows passwords in session config correctly by detecting
the VirtualProvider, unmarshalling the original config and then
shadowing config within that.
2019-11-14 22:34:47 +00:00
John Olheiser
1122230d0e Update security (#8990)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-11-14 16:56:17 +00:00
John Olheiser
9619ccf0e5 Changelog for 1.10.0 (#8978)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-11-14 00:09:58 -05:00
guillep2k
023ae3c48c Hotfix for review actions and notifications (#8965) 2019-11-14 00:38:12 +00:00
John Olheiser
3227a11f71 Backport 1.9.6 (#8969)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-11-13 21:31:27 +00:00
zeripath
3497efac4a
Add Close() method to gogitRepository (#8901) (#8956)
Backport #8901 

In investigating #7947 it has become clear that the storage component of go-git repositories needs closing.

This PR adds this Close function and adds the Close functions as necessary.

In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files.

Fixes #7947
2019-11-13 13:54:04 +00:00
mrsdizzie
43fc99a7ed Update Github Migration Tests (#8938) (#8945)
Update all Github migration tests to use a new repo created just for
these tests that won't accidentially be modified by regular users
interacting with issues.

Fixes #8895
2019-11-13 00:15:57 -05:00
guillep2k
8693e54426 Backport: Enable punctuations ending mentions (#8889) (#8894)
* Enable punctuations ending mentions

* Improve tests
2019-11-09 20:24:59 -05:00
zeripath
b27cac021f
Fix issue with user.fullname (#8903) 2019-11-10 00:06:38 +00:00
guillep2k
ca69ded83e Update Github migration test (#8896)
Earlier today #716 was reopened which updated the modification time for
an old milestone (1.6.0) that we use in testing with the assumption that
it is old and won't change. This breaks all builds now, so remove this
test since we have others that test the same code and this milestone
will likely be updated again as that issue changes etc...
2019-11-09 15:15:36 -05:00
guillep2k
fbcf235633 Backport: Fix password complexity check on registration (#8887) (#8888)
* Fix registration password complexity

* Fix integration to use a complex password ;)
2019-11-09 11:52:54 +00:00
guillep2k
1275c88589 Backport: Fix require external registration password (#8885) (#8890)
* Fix require external registration password

* Fix ctx on error condition by @jolheiser
2019-11-09 08:30:24 +00:00
mrsdizzie
42d0efd1f3 Fix edit content button on migrated issue content (#8877) (#8884)
Typo on a closing span tag caused edit button not to work properly on
the original issue content for a migrated issue.

Fixes #8876
2019-11-08 23:43:51 +08:00
Lauris BH
68b7f9f3f7
Fix to close opened io resources as soon as not needed (#8839) (#8846)
* Fix to close opened io resources as soon as not needed

* Remove unneeded err checks
2019-11-05 22:14:56 +02:00
Lauris BH
26457782c1 Fix new user form for non-local users (#8826) (#8828) 2019-11-05 08:19:32 +08:00
Lauris BH
1c65ecc1c6
Fix commit expand button to not go to commit link (#8745) (#8825)
* Fix commit expand button to not go to commit link

* Fix message rendering to have correct HTML in result

* Fix check for empty commit message

* Code optimization
2019-11-04 20:59:17 +02:00
6543
c5e5063ec9 Fix SSH2 conditonal in key parsing code (#8806) (#8810)
Avoid out of bounds error by using strings.HasPrefix to check for
starting SSH2 text rather than assuming user input has at least 31
characters.

Add tests for bad input as well.

Fixes #8800
2019-11-03 22:51:32 +08:00
6543
b040a87665 add missing "d" (#8801) 2019-11-03 11:13:38 +08:00
2236375d66 fix 500 when edit hook (#8782) (#8789) 2019-11-02 18:41:06 +02:00
zeripath
646fd8b570 On windows set core.longpaths true (#8776) (#8786) 2019-11-02 12:25:13 +01:00
zeripath
4dac8b2389 Allow to merge if file path contains " or \ (#8629) (#8771)
* if a filename in a repository contains " or \ the owner can't merge pull request with this files
because "git diff-tree" adds double quotes to that filepath
example: filepath is ab"cd but "git diff-tree" returns "ab\"cd"

now, when the owner click "Merge Pull Request" button the server returns 500
this commit fix it

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* add -z option to getDiffTree
escape spec symbols for sparse-checkout

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* go fmt

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* typo

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* escape '\'
escape all spaces and '!'

* use regexp.ReplaceAllString()

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* strings.ReplaceAll was added in go 1.12

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* add '\' to regexp.MustCompile

Signed-off-by: Ilya Pavlov <ilux@cpan.org>
2019-11-01 13:50:59 -04:00
John Olheiser
3341aaf3f0 Changelog 1.9.5 (#8753) (#8756)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-10-30 20:34:13 +00:00
John Olheiser
e766f11bd3 Changelog 1.10.0-rc2 (#8750)
* 1.10.0-rc2

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Wording

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update CHANGELOG.md

Co-Authored-By: jaqra <48099350+jaqra@users.noreply.github.com>
2019-10-30 19:27:52 +02:00
6543
432f9dd1a3 [Fix] milestone close timestamp (#8728) (#8730)
* BugFix: Update closed_date_unix colum on milestone table on close

* go fmt
2019-10-29 03:11:24 +00:00
David Svantesson
8caf05989f Fix deadline on update issue or PR via API (#8698) 2019-10-28 01:36:59 +02:00
Monty Taylor
9bde52ffc1 Fix 500 when getting user as unauthenticated user (#8653) (#8663)
Backport #8653

When doing GET /api/v1/users/{user} as an unauthenticated user,
gitea throws a 500 because it's trying to dereference elements
from the context user. It wants to do this to see whether to
show the primary email and will do that if the logged in user
is admin or the user in question. However, if ctx.User is nil there is a panic
2019-10-25 13:09:15 +01:00
jaqra
fa03af8456 make call createMilestoneComment on newIssue func (#8678) (#8681)
* make call createMilestoneComment on newIssue func

* make OldMilestoneID 0 instead of -1
2019-10-25 11:09:19 +01:00
14ebda6fd5 Hide some user information via API if user have no enough permission (#8655) (#8657)
* Hide some user information via API if user have no enough permission

* fix test
2019-10-24 08:59:53 +03:00
zeripath
1d10747514 Use AppSubUrl for more redirections (#8647) (#8651)
Partial backport without changes to locale files.

Fix #8461 - fix misspelling of {{AppSubUrl}} and other misspelling in template
Fixes /explore and organisation redirection
2019-10-23 18:27:10 -04:00
John Olheiser
83c90e9ba0 Add SubURL to redirect path (#8632) (#8634)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-10-22 22:16:20 +01:00
John Olheiser
2fbd5ae2e5 Fix template error on account page (#8562) (#8622) 2019-10-22 10:08:59 +01:00
guillep2k
0032278a46 Allow externalID to be UUID (#8551) (#8624)
Signed-off-by: Wenxuan Zhao <viz@linux.com>
2019-10-22 09:12:10 +01:00
guillep2k
ccf5298a2c Prevent .code-view from overriding font on icon fonts (#8614) (#8627) 2019-10-22 14:39:40 +08:00
zeripath
ece768ab6e
Expose db.SetMaxOpenConns and allow non MySQL dbs to set conn pool params (#8528) (#8618)
* Expose db.SetMaxOpenConns and allow other dbs to set their connection params
* Add note about port exhaustion

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
2019-10-22 07:00:37 +01:00
guillep2k
bac9424a62 fix emoji panel be removed bug in issue page, when the sub issue summit the duplicate emoji (#8609) (#8623) 2019-10-22 02:17:25 +03:00
zeripath
afeab941b3
Update heatmap fixtures to restore tests (#8615) (#8616)
* Update heatmap fixtures to restore tests
* Add hint to check the fixture age on fail
2019-10-21 22:15:55 +01:00
6543
cf35355db8 Ensure that diff stats can scroll independently of the diff (#8581) (#8611)
This PR ensures that once opened the diff stats detail box can be scrolled independently of the diff on the compare page.

Fixes #5532 

Details:

* make diff-detail-box the main container
* move file diff at the same level as diff-stats
* make diff-view options sticy again
* make diff-stats scroll if to mouch
* rm useless css info
* less: mv diff-stats to own class
* use new css class
* cleanup less file
* diff-counter: margin-right: 15px;
* make CI work
* make numbers colorful
* add sign (-/+) to numbers
2019-10-21 16:53:34 +08:00
Viktor Szakats
8e9265c402 webhook: set Content-Type for application/x-www-form-urlencoded (#8600)
This header is missing since switching http client from GiteaServer (`code.gitea.io/gitea/modules/httplib`) to Go-http-client/1.1 (`net.http`). The header [was added by default](https://github.com/go-gitea/gitea/blob/release/v1.8/modules/httplib/httplib.go#L301) by the former, but this is no longer true with `net.http`, so it needs to be done explicitly.

Closes: #7700
2019-10-20 18:18:05 +01:00
6543
435ce92935 Fix #8582 by handling empty repos (#8587) (#8594)
* Fix #8582 by handling empty repos

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix tests

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2019-10-19 21:35:22 +01:00
22cea96c18 Fix bug on pull requests when transfer head repository (#8564) (#8569)
* fix bug on pull requests when transfer head repository

* add migration and fix lint

* fix tests and add a cache check on LoadBaseRepo
2019-10-19 08:29:35 +01:00
6543
7565ac02c2 Allow more than 255 characters for tokens in external_login_user tabl… (#8585)
* Allow more than 255 characters for tokens in external_login_user table (#8554)

Signed-off-by: Wenxuan Zhao <viz@linux.com>

* use old xorm repo
2019-10-19 12:54:09 +08:00
zeripath
4e85c8e0d8
Add missed close in ServeBlobLFS (#8527) (#8542) 2019-10-16 20:32:15 +01:00
zeripath
34b8becef0 Ensure that GitRepo is set on Empty repositories (#8539) (#8541)
Both issues/new and settings/hooks/git expect `ctx.Repo.GitRepo` to be set.
This PR changes the context code to open the GitRepo.

Fixes #8538
2019-10-17 00:03:25 +08:00
6543
0752a3895a Fix migrate mirror 500 bug (#8526) (#8530)
* fix migrate mirror 500 bug

* update backport
2019-10-16 10:48:45 +01:00
guillep2k
595033f78e Fix password complexity regex for special characters (backport for v1.10.0) (#8524)
* Fix extra space

* Fix regular expression

* Fix error template name

* Simplify check code, fix default values, add test

* Fix router tests

* Fix fmt

* Fix setting and lint

* Move cleaning up code to test, improve comments

* Tidy up variable declaration
2019-10-16 11:09:27 +08:00
297 changed files with 6946 additions and 4349 deletions

View File

@ -1,44 +1,44 @@
repo: go-gitea/gitea
groups:
-
-
name: BREAKING
labels:
- kind/breaking
-
-
name: FEATURE
labels:
- kind/feature
-
name: SECURITY
labels:
- kind/security
-
name: BUGFIXES
labels:
- kind/bug
-
-
name: ENHANCEMENT
labels:
- kind/enhancement
- kind/refactor
- kind/ui
-
name: SECURITY
labels:
- kind/security
-
name: TESTING
labels:
- kind/testing
-
-
name: TRANSLATION
labels:
- kind/translation
-
-
name: BUILD
labels:
- kind/build
- kind/lint
-
-
name: DOCS
labels:
- kind/docs
-
-
name: MISC
default: true
default: true

View File

@ -30,6 +30,7 @@ services:
image: postgres:9.5
environment:
POSTGRES_DB: test
POSTGRES_PASSWORD: postgres
- name: mssql
pull: default
@ -388,7 +389,7 @@ steps:
- name: static
pull: always
image: techknowlogick/xgo:latest
image: techknowlogick/xgo:go-1.13.x
commands:
- export PATH=$PATH:$GOPATH/bin
- make generate
@ -490,7 +491,7 @@ steps:
- name: static
pull: always
image: techknowlogick/xgo:latest
image: techknowlogick/xgo:go-1.13.x
commands:
- export PATH=$PATH:$GOPATH/bin
- make generate

View File

@ -4,12 +4,103 @@ 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.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.10.0-rc1) - 2019-10-14
## [1.10.6](https://github.com/go-gitea/gitea/releases/tag/v1.10.6) - 2020-03-10
This is a re-tag version of v1.10.5 and also explicitly built with Go 1.13.
WARNING: v1.10.5 is incorrectly tagged targeting 1.12-dev and should **not** be used.
## [1.10.5](https://github.com/go-gitea/gitea/releases/tag/v1.10.5) - 2020-03-06
* BUGFIXES
* Fix release attachments being deleted while upgrading (#10572) (#10574)
## [1.10.4](https://github.com/go-gitea/gitea/releases/tag/v1.10.4) - 2020-02-16
* FEATURE
* Prevent empty LDAP search from deactivating all users (#9879) (#9890)
* BUGFIXES
* Fix reply on code review (#10261) (#10227)
* Fix branch page pull request title and link error (#10092) (#10098)
* Fix milestone API state parameter unhandled (#10049) (#10053)
* Fix wiki raw view on sub path (#10002) (#10041)
* Fix RocketChat Webhook (#9908) (#9921) (#9925)
* Fix bug about wrong dependencies permissions check and other wrong permissions check (#9884) (Partial backport #9842)
* Ensure that 2fa is checked on reset-password (#9857) (#9877)
## [1.10.3](https://github.com/go-gitea/gitea/releases/tag/v1.10.3) - 2020-01-17
* SECURITY
* Hide credentials when submitting migration (#9102) (#9704)
* Never allow an empty password to validate (#9682) (#9684)
* Prevent redirect to Host (#9678) (#9680)
* Hide public repos owned by private orgs (#9609) (#9616)
* BUGFIXES
* Allow assignee on Pull Creation when Issue Unit is deactivated (#9836) (#9838)
* Fix download file wrong content-type (#9825) (#9835)
* Fix wrong identify poster on a migrated pull request when submit review (#9827) (#9831)
* Fix dump non-exist log directory (#9818) (#9820)
* Fix compare (#9808) (#9815)
* Fix missing msteam webhook on organization (#9781) (#9795)
* Fix add team on collaborator page when same name as organization (#9783)
* Fix cache problem on dashboard (#9358) (#9703)
* Send tag create and push webhook when release created on UI (#8671) (#9702)
* Branches not at ref commit ID should not be listed as Merged (#9614) (#9639)
## [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)
* Properly fix displaying virtual session provider in admin panel (#9137) (#9203)
* Upgrade levelqueue to 0.1.0 (#9192) (#9199)
* Fix panic when diff (#9187) (#9193)
* Smtp logger configuration sendTos should be an array (#9154) (#9157)
* Always Show Password Field on Link Account Sign-in Page (#9150)
* Create PR on Current Repository by Default (#8670) (#9141)
* Fix race on indexer (#9136) (#9139)
* Fix reCAPTCHA URL (#9119)
* Hide migrated credentials (#9098)
* Update golang.org/x/crypto vendor to use acme v2 (#9056) (#9085)
* Fix password checks on admin create/edit user (#9076) (#9081)
* Fix add search as a reserved username (#9063) (#9065)
* Fix permission checks for close/reopen from commit (#8875) (#9033)
* Ensure Written is set in GZIP ProxyResponseWriter (#9018) (#9025)
* Fix broken link to branch from issue list (#9003) (#9021)
* Fix wrong system notice when repository is empty (#9020)
* Shadow password correctly for session config (#8984) (#9002)
## [1.10.0](https://github.com/go-gitea/gitea/releases/tag/v1.10.0) - 2019-11-13
* BREAKING
* Fix deadline on update issue or PR via API (#8698)
* Hide some user information via API if user doesn't have enough permission (#8655) (#8657)
* Remove legacy handling of drone token (#8191)
* Change repo search to use exact match for topic search. (#7941)
* Add pagination for admin api get orgs and fix only list public orgs bug (#7742)
* Implement the ability to change the ssh port to match what is in the gitea config (#7286)
* SECURITY
* Fix issue with user.fullname (#8903)
* Ignore mentions for users with no access (#8395)
* Be more strict with git arguments (#7715)
* Extract the username and password from the mirror url (#7651)
* reserve .well-known username (#7637)
* FEATURE
* Org/Members: display 2FA members states + optimize sql requests (#7621)
* SetDefaultBranch on pushing to empty repository (#7610)
@ -19,6 +110,41 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
* Add option to initialize repository with labels (#6061)
* Add additional password hash algorithms (#6023)
* BUGFIXES
* Allow to merge if file path contains " or \ (#8629) (#8771)
* On windows set core.longpaths true (#8776) (#8786)
* Fix 500 when edit hook (#8782) (#8789)
* Fix Checkbox at RepoSettings Protected Branch (#8799) (#8801)
* Fix SSH2 conditional in key parsing code (#8806) (#8810)
* Fix commit expand button to not go to commit link (#8745) (#8825)
* Fix new user form for non-local users (#8826) (#8828)
* Fix to close opened io resources as soon as not needed (#8839) (#8846)
* Fix edit content button on migrated issue content (#8877) (#8884)
* Fix require external registration password (#8885) (#8890)
* Fix password complexity check on registration (#8887) (#8888)
* Update Github Migration Tests (#8896) (#8938) (#8945)
* Enable punctuations ending mentions (#8889) (#8894)
* Add Close() method to gogitRepository (#8901) (#8956)
* Hotfix for review actions and notifications (#8965)
* Expose db.SetMaxOpenConns and allow non MySQL dbs to set conn pool params (#8528) (#8618)
* Fix milestone close timestamp (#8728) (#8730)
* Fix 500 when getting user as unauthenticated user (#8653) (#8663)
* Fix 'New Issue Missing Milestone Comment' (#8678) (#8681)
* Use AppSubUrl for more redirections (#8647) (#8651)
* Add SubURL to redirect path (#8632) (#8634)
* Fix template error on account page (#8562) (#8622)
* Allow externalID to be UUID (#8551) (#8624)
* Prevent removal of non-empty emoji panel following selection of duplicate (#8609) (#8623)
* Update heatmap fixtures to restore tests (#8615) (#8616)
* Ensure that diff stats can scroll independently of the diff (#8581) (#8621)
* Webhook: set Content-Type for application/x-www-form-urlencoded (#8600)
* Fix #8582 by handling empty repos (#8587) (#8594)
* Fix bug on pull requests when transfer head repository (#8564) (#8569)
* Add missed close in ServeBlobLFS (#8527) (#8542)
* Ensure that GitRepo is set on Empty repositories (#8539) (#8541)
* Fix migrate mirror 500 bug (#8526) (#8530)
* Fix password complexity regex for special characters (#8524)
* Prevent .code-view from overriding font on icon fonts (#8614) (#8627)
* Allow more than 255 characters for tokens in external_login_user table (#8554)
* Fix errors in create org UI regarding team access permission (#8506)
* Fix bug on FindExternalUsersByProvider (#8504)
* Create .ssh dir as necessary (#8486)
@ -218,10 +344,6 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
* Support setting cookie domain (#6288)
* Move migrating repository from frontend to backend (#6200)
* Delete releases attachments if release is deleted (#6068)
* SECURITY
* Ignore mentions for users with no access (#8395)
* Be more strict with git arguments (#7715)
* reserve .well-known username (#7637)
* TRANSLATION
* Latvian translation for home page (#8468)
* Add home template italian translation (#8352)
@ -250,7 +372,6 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
* Fix global search result CSS, misc CSS tweaks (#7789)
* Tweak label border CSS (#7739)
* Fix create menu item widths (#7708)
* Extract the username and password from the mirror url (#7651)
* [Branch View] Delete duplicate protection symbol (#7624)
* [Branch View] Delete Table Header (#7622)
* [Branch View] icons to buttons (#7602)
@ -263,6 +384,38 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
* wiki - editor - add buttons 'inline code', 'empty checkbox', 'checked checkbox' (#7243)
* Fix Statuses API only shows first 10 statuses: Add paging and extend API GetCommitStatuses (#7141)
## [1.9.6](https://github.com/go-gitea/gitea/releases/tag/v1.9.6) - 2019-11-13
* BUGFIXES
* Allow to merge if file path contains " or \ (#8629) (#8772)
* Fix 500 when edit hook (#8782) (#8790)
* Fix issue with user.fullname (#8904)
* Update Github Migration Test (#8897) (#8946)
* Add Close() method to gogitRepository (#8901) (#8958)
## [1.9.5](https://github.com/go-gitea/gitea/releases/tag/v1.9.5) - 2019-10-30
* BREAKING
* Hide some user information via API if user doesn't have enough permission (#8655) (#8658)
* BUGFIXES
* Fix milestone close timestamp (#8728) (#8731)
* Fix deadline on update issue or PR via API (#8699)
* Fix 'New Issue Missing Milestone Comment' (#8678) (#8682)
* Fix 500 when getting user as unauthenticated user (#8653) (#8662)
* Use AppSubUrl for more redirections (#8647) (#8652)
* Add SubURL to redirect path (#8632) (#8634) (#8640)
* Fix #8582 by handling empty repos (#8587) (#8593)
* Fix bug on pull requests when transfer head repository (#8571)
* Add missed close in ServeBlobLFS (#8527) (#8543)
* Return false if provided branch name is empty for IsBranchExist (#8485) (#8492)
* Create .ssh dir as necessary (#8369) (#8486) (#8489)
* Restore functionality for early gits (#7775) (#8476)
* Add check for empty set when dropping indexes during migration (#8475)
* Ensure Request Body Readers are closed in LFS server (#8454) (#8459)
* Ensure that LFS files are relative to the LFS content path (#8455) (#8458)
* SECURITY
* Ignore mentions for users with no access (#8395) (#8484)
* TESTING
* Update heatmap fixtures to restore tests (#8615) (#8617)
## [1.9.4](https://github.com/go-gitea/gitea/releases/tag/v1.9.4) - 2019-10-08
* BUGFIXES
* Highlight issue references (#8101) (#8404)

View File

@ -375,17 +375,20 @@ func runRepoSyncReleases(c *cli.Context) error {
if err = models.SyncReleasesWithTags(repo, gitRepo); err != nil {
log.Warn(" SyncReleasesWithTags: %v", err)
gitRepo.Close()
continue
}
count, err = getReleaseCount(repo.ID)
if err != nil {
log.Warn(" GetReleaseCountByRepoID: %v", err)
gitRepo.Close()
continue
}
log.Trace(" repo %s releases synchronized to tags: from %d to %d",
repo.FullName(), oldnum, count)
gitRepo.Close()
}
}

View File

@ -61,6 +61,10 @@ var (
Name: "admin-filter",
Usage: "An LDAP filter specifying if a user should be given administrator privileges.",
},
cli.BoolFlag{
Name: "allow-deactivate-all",
Usage: "Allow empty search results to deactivate all users.",
},
cli.StringFlag{
Name: "username-attribute",
Usage: "The attribute of the users LDAP record containing the user name.",
@ -231,6 +235,9 @@ func parseLdapConfig(c *cli.Context, config *models.LDAPConfig) error {
if c.IsSet("admin-filter") {
config.Source.AdminFilter = c.String("admin-filter")
}
if c.IsSet("allow-deactivate-all") {
config.Source.AllowDeactivateAll = c.Bool("allow-deactivate-all")
}
return nil
}

View File

@ -145,8 +145,10 @@ func runDump(ctx *cli.Context) error {
}
}
if err := z.AddDir("log", setting.LogRootPath); err != nil {
log.Fatalf("Failed to include log: %v", err)
if com.IsExist(setting.LogRootPath) {
if err := z.AddDir("log", setting.LogRootPath); err != nil {
log.Fatalf("Failed to include log: %v", err)
}
}
if err = z.Close(); err != nil {

View File

@ -277,10 +277,12 @@ LOG_SQL = true
DB_RETRIES = 10
; Backoff time per DB retry (time.Duration)
DB_RETRY_BACKOFF = 3s
; Max idle database connections on connnection pool, default is 0
MAX_IDLE_CONNS = 0
; Database connection max life time, default is 3s
; Max idle database connections on connnection pool, default is 2
MAX_IDLE_CONNS = 2
; Database connection max life time, default is 0 or 3s mysql (See #6804 & #7071 for reasoning)
CONN_MAX_LIFETIME = 3s
; Database maximum number of open connections, default is 0 meaning no maximum
MAX_OPEN_CONNS = 0
[indexer]
; Issue indexer type, currently support: bleve or db, default is bleve
@ -333,7 +335,8 @@ IMPORT_LOCAL_PATHS = false
; Set to true to prevent all users (including admin) from creating custom git hooks
DISABLE_GIT_HOOKS = false
;Comma separated list of character classes required to pass minimum complexity.
;If left empty or no valid values are specified, the default values (`lower,upper,digit,spec`) will be used.
;If left empty or no valid values are specified, the default values ("lower,upper,digit,spec") will be used.
;Use "off" to disable checking.
PASSWORD_COMPLEXITY = lower,upper,digit,spec
; Password Hash algorithm, either "pbkdf2", "argon2", "scrypt" or "bcrypt"
PASSWORD_HASH_ALGO = pbkdf2
@ -822,6 +825,6 @@ TOKEN =
QUEUE_TYPE = channel
; Task queue length, available only when `QUEUE_TYPE` is `channel`.
QUEUE_LENGTH = 1000
; Task queue connction string, available only when `QUEUE_TYPE` is `redis`.
; Task queue connection string, available only when `QUEUE_TYPE` is `redis`.
; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`.
QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"
QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"

View File

@ -167,8 +167,12 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `LOG_SQL`: **true**: Log the executed SQL.
- `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed.
- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured.
- `MAX_IDLE_CONNS` **0**: Max idle database connections on connnection pool, default is 0
- `CONN_MAX_LIFETIME` **3s**: Database connection max lifetime
- `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit.
- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`.
- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071).
Please see #8540 & #8273 for further discussion of the appropriate values for `MAX_OPEN_CONNS`, `MAX_IDLE_CONNS` & `CONN_MAX_LIFETIME` and their
relation to port exhaustion.
## Indexer (`indexer`)
@ -212,7 +216,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- lower - use one or more lower latin characters
- upper - use one or more upper latin characters
- digit - use one or more digits
- spec - use one or more special characters as ``][!"#$%&'()*+,./:;<=>?@\^_{|}~`-`` and space symbol.
- spec - use one or more special characters as ``!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``
- off - do not check password complexity
## OpenID (`openid`)

View File

@ -68,6 +68,7 @@ type Uploader interface {
CreateComment(issueNumber int64, comment *Comment) error
CreatePullRequest(pr *PullRequest) error
Rollback() error
Close()
}
```
```

4
go.mod
View File

@ -4,6 +4,7 @@ go 1.13
require (
cloud.google.com/go v0.45.0 // indirect
gitea.com/lunny/levelqueue v0.1.0
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b
gitea.com/macaron/cache v0.0.0-20190822004001-a6e7fee4ee76
gitea.com/macaron/captcha v0.0.0-20190822015246-daa973478bae
@ -67,7 +68,6 @@ require (
github.com/lafriks/xormstore v1.3.1
github.com/lib/pq v1.2.0
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e
github.com/mailru/easyjson v0.7.0 // indirect
github.com/markbates/goth v1.56.0
github.com/mattn/go-isatty v0.0.7
@ -104,7 +104,7 @@ require (
github.com/urfave/cli v1.20.0
github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621 // indirect
github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba
golang.org/x/net v0.0.0-20190909003024-a7b16738d86b
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sys v0.0.0-20190910064555-bbd175535a8b

6
go.sum
View File

@ -12,6 +12,8 @@ cloud.google.com/go v0.45.0 h1:bALuGBSgE+BD4rxsopAYlqjcwqcQtye6pWG4bC3N/k0=
cloud.google.com/go v0.45.0/go.mod h1:452BcPOeI9AZfbvDw0Tbo7D32wA+WX9WME8AZwMEDZU=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
gitea.com/lunny/levelqueue v0.1.0 h1:7wMk0VH6mvKN6vZEZCy9nUDgRmdPLgeNrm1NkW8EHNk=
gitea.com/lunny/levelqueue v0.1.0/go.mod h1:G7hVb908t0Bl0uk7zGSg14fyzNtxgtD9Shf04wkMK7s=
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b h1:vXt85uYV17KURaUlhU7v4GbCShkqRZDSfo0TkC0YCjQ=
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b/go.mod h1:Cxadig6POWpPYYSfg23E7jo35Yf0yvsdC1lifoKWmPo=
gitea.com/macaron/cache v0.0.0-20190822004001-a6e7fee4ee76 h1:mMsMEg90c5KXQgRWsH8D6GHXfZIW1RAe5S9VYIb12lM=
@ -391,8 +393,6 @@ github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 h1:uNwtsDp7ci48vBTTxDuwcoTXz4lwtDTe7TjCQ0noaWY=
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96/go.mod h1:mmIfjCSQlGYXmJ95jFN84AkQFnVABtKuJL8IrzwvUKQ=
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e h1:GSprKUrG9wNgwQgROvjPGXmcZrg4OLslOuZGB0uJjx8=
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e/go.mod h1:rQZVENnBOiVakCs97XvclbwJRTAv77CRFWcYVNDkVf8=
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de h1:nyxwRdWHAVxpFcDThedEgQ07DbcRc5xgNObtbTp76fk=
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de/go.mod h1:3q8WtuPQsoRbatJuy3nvq/hRSvuBJrHHr+ybPPiNvHQ=
github.com/lunny/nodb v0.0.0-20160621015157-fc1ef06ad4af h1:UaWHNBdukWrSG3DRvHFR/hyfg681fceqQDYVTBncKfQ=
@ -627,6 +627,8 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49N
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad h1:5E5raQxcv+6CZ11RrBYQe5WRbUIWpScjh0kvHZkZIrQ=
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba h1:9bFeDpN3gTqNanMVqNcoR/pJQuP5uroC3t1D7eXozTE=
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=

View File

@ -0,0 +1,47 @@
// 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.
package integrations
import (
"fmt"
"net/http"
"testing"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/structs"
"github.com/stretchr/testify/assert"
)
func TestAPIIssuesMilestone(t *testing.T) {
prepareTestEnv(t)
milestone := models.AssertExistsAndLoadBean(t, &models.Milestone{ID: 1}).(*models.Milestone)
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: milestone.RepoID}).(*models.Repository)
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
assert.Equal(t, int64(1), int64(milestone.NumIssues))
assert.Equal(t, structs.StateOpen, milestone.State())
session := loginUser(t, owner.Name)
token := getTokenForLoggedInUser(t, session)
// update values of issue
milestoneState := "closed"
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/milestones/%d?token=%s", owner.Name, repo.Name, milestone.ID, token)
req := NewRequestWithJSON(t, "PATCH", urlStr, structs.EditMilestoneOption{
State: &milestoneState,
})
resp := session.MakeRequest(t, req, http.StatusOK)
var apiMilestone structs.Milestone
DecodeJSON(t, resp, &apiMilestone)
assert.EqualValues(t, "closed", apiMilestone.State)
req = NewRequest(t, "GET", urlStr)
resp = session.MakeRequest(t, req, http.StatusOK)
var apiMilestone2 structs.Milestone
DecodeJSON(t, resp, &apiMilestone2)
assert.EqualValues(t, "closed", apiMilestone2.State)
}

View File

@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"testing"
"time"
"code.gitea.io/gitea/models"
api "code.gitea.io/gitea/modules/structs"
@ -62,3 +63,61 @@ func TestAPICreateIssue(t *testing.T) {
Title: title,
})
}
func TestAPIEditIssue(t *testing.T) {
prepareTestEnv(t)
issueBefore := models.AssertExistsAndLoadBean(t, &models.Issue{ID: 9}).(*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 := time.Unix(0, 0)
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,
Deadline: &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: 9}).(*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)
}

View File

@ -51,6 +51,7 @@ func TestAPICreateAndUpdateRelease(t *testing.T) {
gitRepo, err := git.OpenRepository(repo.RepoPath())
assert.NoError(t, err)
defer gitRepo.Close()
err = gitRepo.CreateTag("v0.0.1", "master")
assert.NoError(t, err)
@ -112,6 +113,7 @@ func TestAPICreateReleaseToDefaultBranchOnExistingTag(t *testing.T) {
gitRepo, err := git.OpenRepository(repo.RepoPath())
assert.NoError(t, err)
defer gitRepo.Close()
err = gitRepo.CreateTag("v0.0.1", "master")
assert.NoError(t, err)

View File

@ -30,12 +30,12 @@ func getCreateFileOptions() api.CreateFileOptions {
NewBranchName: "master",
Message: "Making this new file new/file.txt",
Author: api.Identity{
Name: "John Doe",
Email: "johndoe@example.com",
Name: "Anne Doe",
Email: "annedoe@example.com",
},
Committer: api.Identity{
Name: "Jane Doe",
Email: "janedoe@example.com",
Name: "John Doe",
Email: "johndoe@example.com",
},
},
Content: contentEncoded,
@ -77,8 +77,8 @@ func getExpectedFileResponseForCreate(commitID, treePath string) *api.FileRespon
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID,
Author: &api.CommitUser{
Identity: api.Identity{
Name: "Jane Doe",
Email: "janedoe@example.com",
Name: "Anne Doe",
Email: "annedoe@example.com",
},
},
Committer: &api.CommitUser{
@ -139,6 +139,7 @@ func TestAPICreateFile(t *testing.T) {
assert.EqualValues(t, expectedFileResponse.Commit.HTMLURL, fileResponse.Commit.HTMLURL)
assert.EqualValues(t, expectedFileResponse.Commit.Author.Email, fileResponse.Commit.Author.Email)
assert.EqualValues(t, expectedFileResponse.Commit.Author.Name, fileResponse.Commit.Author.Name)
gitRepo.Close()
}
// Test creating a file in a new branch

View File

@ -35,8 +35,8 @@ func getUpdateFileOptions() *api.UpdateFileOptions {
Email: "johndoe@example.com",
},
Committer: api.Identity{
Name: "Jane Doe",
Email: "janedoe@example.com",
Name: "Anne Doe",
Email: "annedoe@example.com",
},
},
SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885",
@ -80,14 +80,14 @@ func getExpectedFileResponseForUpdate(commitID, treePath string) *api.FileRespon
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID,
Author: &api.CommitUser{
Identity: api.Identity{
Name: "Jane Doe",
Email: "janedoe@example.com",
Name: "John Doe",
Email: "johndoe@example.com",
},
},
Committer: &api.CommitUser{
Identity: api.Identity{
Name: "John Doe",
Email: "johndoe@example.com",
Name: "Anne Doe",
Email: "annedoe@example.com",
},
},
Message: "My update of README.md\n",
@ -143,6 +143,7 @@ func TestAPIUpdateFile(t *testing.T) {
assert.EqualValues(t, expectedFileResponse.Commit.HTMLURL, fileResponse.Commit.HTMLURL)
assert.EqualValues(t, expectedFileResponse.Commit.Author.Email, fileResponse.Commit.Author.Email)
assert.EqualValues(t, expectedFileResponse.Commit.Author.Name, fileResponse.Commit.Author.Name)
gitRepo.Close()
}
// Test updating a file in a new branch

View File

@ -74,6 +74,8 @@ func testAPIGetContentsList(t *testing.T, u *url.URL) {
repo1.CreateNewBranch(user2, repo1.DefaultBranch, newBranch)
// Get the commit ID of the default branch
gitRepo, _ := git.OpenRepository(repo1.RepoPath())
defer gitRepo.Close()
commitID, _ := gitRepo.GetBranchCommitID(repo1.DefaultBranch)
// Make a new tag in repo1
newTag := "test_tag"

View File

@ -75,6 +75,8 @@ func testAPIGetContents(t *testing.T, u *url.URL) {
repo1.CreateNewBranch(user2, repo1.DefaultBranch, newBranch)
// Get the commit ID of the default branch
gitRepo, _ := git.OpenRepository(repo1.RepoPath())
defer gitRepo.Close()
commitID, _ := gitRepo.GetBranchCommitID(repo1.DefaultBranch)
// Make a new tag in repo1
newTag := "test_tag"

View File

@ -29,6 +29,8 @@ func TestAPIGitTags(t *testing.T) {
git.NewCommand("config", "user.email", user.Email).RunInDir(repo.RepoPath())
gitRepo, _ := git.OpenRepository(repo.RepoPath())
defer gitRepo.Close()
commit, _ := gitRepo.GetBranchCommit("master")
lTagName := "lightweightTag"
gitRepo.CreateTag(lTagName, commit.ID.String())

View File

@ -334,7 +334,7 @@ func testAPIRepoMigrateConflict(t *testing.T, u *url.URL) {
resp := httpContext.Session.MakeRequest(t, req, http.StatusConflict)
respJSON := map[string]string{}
DecodeJSON(t, resp, &respJSON)
assert.Equal(t, respJSON["message"], "The repository with the same name already exists.")
assert.Equal(t, "The repository with the same name already exists.", respJSON["message"])
})
}

View File

@ -29,7 +29,6 @@ func TestAPITeamUser(t *testing.T) {
var user2 *api.User
DecodeJSON(t, resp, &user2)
user2.Created = user2.Created.In(time.Local)
user2.LastLogin = user2.LastLogin.In(time.Local)
user := models.AssertExistsAndLoadBean(t, &models.User{Name: "user2"}).(*models.User)
assert.Equal(t, convert.ToUser(user, true, false), user2)

View File

@ -26,7 +26,7 @@ func TestUserHeatmap(t *testing.T) {
var heatmap []*models.UserHeatmapData
DecodeJSON(t, resp, &heatmap)
var dummyheatmap []*models.UserHeatmapData
dummyheatmap = append(dummyheatmap, &models.UserHeatmapData{Timestamp: 1540080000, Contributions: 1})
dummyheatmap = append(dummyheatmap, &models.UserHeatmapData{Timestamp: 1571616000, Contributions: 1})
assert.Equal(t, dummyheatmap, heatmap)
}

View File

@ -0,0 +1 @@
4a357436d925b5c974181ff12a994538ddc5a269

View File

@ -1 +1 @@
0cf15c3f66ec8384480ed9c3cf87c9e97fbb0ec3
423313fbd38093bb10d0c8387db9105409c6f196

Some files were not shown because too many files have changed in this diff Show More