2
0
Commit Graph

2173 Commits

Author SHA1 Message Date
mrsdizzie
61d69111ea Fix ParsePatch function to work with quoted diff --git strings (#6323)
* Fix ParsePatch to work properly with quoted diff --git string

Currently ParsePatch fails when a diff contains a quoted diff line like:

diff --git "a/file" "b/file"

This patch makes it properly parse the line when that happens.

Fixes #6309

* Add test for regular case while here

* Simplify string modification
2019-03-14 18:09:53 +02:00
zeripath
6639fd0dd1 Fix reported issue in repo description (#6306) 2019-03-11 22:23:34 -04:00
Lunny Xiao
b129d78a89 update git vendor to fix wrong release commit id and add migrations (#6224)
* update git vendor to fix wrong release commit id and add migrations

* fix count

* fix migration release

* fix tests
2019-03-11 11:44:58 +08:00
zeripath
eb6ac024b0 Remove util.RemoveAll - should have been removed since go 1.7 (#6299) 2019-03-10 23:56:36 +02:00
Aidan Fitzgerald
2455712b21 Copyedit docs (#6275) 2019-03-09 16:15:45 -05:00
Jonas Franz
9e763c8c77 Integrate OAuth2 Provider (#5378) 2019-03-08 11:42:50 -05:00
techknowlogick
842152b666 Add robots.txt as reserved username (#6272)
Fix #6271
2019-03-07 16:30:25 -05:00
stevegt
a402b610e4 Add ability to sort issues by due date (#6206) (#6244)
Signed-off-by: Steve Traugott <stevegt@t7a.org>
2019-03-05 09:39:41 -05:00
zeripath
3cda86b232 Prevent double-close of issues (#6233) 2019-03-04 21:52:52 -05:00
Maurizio Porrato
2842f71642 Override xorm type mapping for U2F counter (#6232) 2019-03-04 21:34:52 -05:00
Lanre Adelowo
cf95ef4e55 add isAdmin to user model (#6231)
update vendor and add tests

fix swagger
2019-03-03 17:57:24 -05:00
James E. Blair
5d0173e49d Fix renames over redirects (#6216)
In #6211, we started creating repo_redirects for ownership transfers,
however that opens an edge case where a user might perform the
following sequence:

rename org1/repo1 -> org1/repo2  (creates org1/repo1 redirect)
transfer org2/repo1 -> org1/repo1 (org1/repo1 redirect continues to exist)
rename org1/repo1 -> org1/repo3 (fails due to existing org1/repo1 redirect)

This change ensures that each time we rename or transfer a repo,
we delete any existing redirects at the target location.  This
already happens when a new repo is created.  By doing this we ensure
that we'll never have both a repo and a redirect at the same location.

Signed-off-by: James E. Blair <jeblair@redhat.com>
2019-03-02 15:07:19 +02:00
tklein23
98147e1be7 Add "ghost" and "notifications" to list of reserved user names. (#6208) 2019-02-27 19:04:44 -05:00
John Olheiser
47bbca3ee6 Change sqlite DB path default to data directory (#6198) 2019-02-27 11:55:08 -05:00
Lunny Xiao
26c3e8af0f fix bug when update owner team then visit team's repo return 404 (#6119) 2019-02-22 11:14:45 -05:00
John Olheiser
b4d3bfe454 Admins can now do unlimited page size user search (listAllUsers & listAllOrgs) (#6143)
Non-admins will default to 10 page size
2019-02-21 15:42:54 -05:00
Lunny Xiao
c59ca5c20e Add more tests and docs for issue indexer, add db indexer type for searching from database (#6144)
* add more tests and docs for issue indexer, add db indexer type for searching from database

* fix typo

* fix typo

* fix lint

* improve docs
2019-02-21 13:01:28 +08:00
Lunny Xiao
e29053b966 refactor issue indexer, add some testing and fix a bug (#6131)
* refactor issue indexer, add some testing and fix a bug

* fix error copyright year on comment header

* issues indexer package import keep consistent
2019-02-21 08:54:05 +08:00
Lunny Xiao
00227e19d1 Refactor issue indexer (#5363) 2019-02-19 09:39:39 -05:00
Lanre Adelowo
62cc5c3c4e Show email if the authenticated user owns the profile page being requested for (#4981)
* Show email if the authenticated user owns the profile page being
requested for.

Also removed `setting.UI.ShowUserEmail` as it's documentation says it
only controls the email setting on the explore page

* fix current user check... This prevents a panic as a user must be signed in before ctx.User is called

* fix panic in tests

* try to fix tests

* Update year

* Test CI fail

* Revert change

* User 3 is not allowed to authorize

* Set user2 email to be private

* Change to user4 in explore page as user2 now has private email option set
2019-02-19 09:11:50 -05:00
Lunny Xiao
88299adc71 Fix prohibit login check on authorization (#6106)
* fix bug prohibit login not applied on dashboard

* fix tests

* fix bug user status leak

* fix typo

* return after render
2019-02-19 09:19:28 +02:00
Lanre Adelowo
9fe3ab1e74 Implement "conversation lock" for issue comments (#5073) 2019-02-18 22:55:04 +02:00
Rémy Boulanouar
dd49ae1b07 Allow to set organization visibility (public, internal, private) (#1763) 2019-02-18 18:00:27 +02:00
zeripath
c99cef58a7 Fix deadlock in webhook PullRequest (#6102)
Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-02-17 21:12:39 +00:00
Zsombor
b6c9426d95 Fix panic: template: repo/issue/list:210: unexpected "=" in operand (#6041) 2019-02-13 10:14:17 +02:00
zeripath
c4ae481ad4 Refactor editor upload, update and delete to use git plumbing and add LFS support (#5702)
* Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFile

* Use git plumbing for upload: #5621 repo_editor.go: GetDiffPreview

* Use git plumbing for upload: #5621 repo_editor.go: DeleteRepoFile

* Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFiles

* Move branch checkout functions out of repo_editor.go as they are no longer used there

* BUGFIX: The default permissions should be 100644

    This is a change from the previous code but is more in keeping
    with the default behaviour of git.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Standardise cleanUploadFilename to more closely match git

See verify_path in: 7f4e641693/read-cache.c (L951)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Redirect on bad paths

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Refactor to move the uploading functions out to a module

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add LFS support

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update upload.go attribution header

Upload.go is essentially the remnants of repo_editor.go. The remaining code is essentially unchanged from the Gogs code, hence the Gogs attribution.

* Delete upload files after session committed

* Ensure that GIT_AUTHOR_NAME etc. are valid for git

see #5774

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add in test cases per @lafriks comment

* Add space between gitea and github imports

Signed-off-by: Andrew Thornton <art27@cantab.net>

* more examples in TestCleanUploadName

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fix formatting

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Set the SSH_ORIGINAL_COMMAND to ensure hooks are run

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Switch off SSH_ORIGINAL_COMMAND

Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-02-12 15:07:31 +02:00
Lanre Adelowo
54e1cf08f2 Add option to close issues via commit on a non master branch (#5992)
* fixes #5957

* add tests to make sure config option is respected

* use already defined struct

* - use migration to make the flag repo wide not for the entire gitea instance
Also note that the config value can still be set so as to be able to control the value for new repositories that are to be created

- fix copy/paste error in copyright header year and rearrange import

- use repo config instead of server config value to determine if a commit should close an issue

- update testsuite

* use global config only when creating a new repository

* allow repo admin toggle feature via UI

* fix typo and improve testcase

* fix fixtures

* add DEFAULT prefix to config value

* fix test
2019-02-10 21:27:19 +02:00
Lanre Adelowo
a8192fdeb1 disable git fsck for mirrored repos by default (#6018) 2019-02-09 14:34:50 +00:00
Richard Mahn
f36c37bbf9 Feature - #3031 - search for org repos (#5986) 2019-02-08 11:45:43 -05:00
Lunny Xiao
7f07db81aa Add API to list tags (#5850)
* Add API to list tags

* update dependency gitea sdk vendor

* fix swagger generation

* fix swagger

* add tests

* update code.gitea.io/git vendor
2019-02-07 12:00:52 +00:00
zeripath
bc21eb4ab6 Fix empty ssh key importing in ldap (#5984) 2019-02-06 21:38:28 -05:00
Gabriel Silva Simões
eb241bb455 Fix serving of raw wiki files other than .md (#5814)
* Fix serving of raw wiki files other than .md

Closes #4690.
Closes #4395.

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>

* Simplify code at routers/repo/wiki.go

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>

* Add more files to user2/repo1.wiki for testing

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>

* Update macaron to v1.3.2

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>

* Add tests for WikiRaw

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>

* Fix NewResponseWriter usage due to macaron update

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>

* Add raw to reserved wiki names

Signed-off-by: Gabriel Silva Simões <simoes.sgabriel@gmail.com>
2019-02-05 20:58:55 -05:00
Lunny Xiao
2e9bdfcb89 Pull request conflict files detection (#5951)
* add conflict detection

* test pull request conflict files

* fix detection files number

* fix comments
2019-02-05 06:54:49 -05:00
Lanre Adelowo
455ba5e5d0 Automatically clear stopwatch on merging a PR (#4327)
* Don't display buttons if there are no notices

* clear stopwatch on merging a PR

* remove redundant gt check

* use ctx.Flash as per @bkcsoft comment

* stop timer on closing issues/PRs too

* updated translation as per review

* redirect to login page after successfully activating account

* remove unrelated changes

* stop timer for issues that are closed via commits too..Not just the 'close' UI button
2019-02-05 13:38:11 +02:00
Lanre Adelowo
6b2f301238 Add label names as filter in issue search api (#5946) 2019-02-04 10:20:44 -05:00
zeripath
396b45f25c Fix ssh deploy and user key constraints (#1357) (#5939)
1. A key can either be an ssh user key or a deploy key. It cannot be both.
2. If a key is a user key - it can only be associated with one user.
3. If a key is a deploy key - it can be used in multiple repositories and the permissions it has on those repositories can be different.
4. If a repository is deleted, its deploy keys must be deleted too.

We currently don't enforce any of this and multiple repositories access with different permissions doesn't work at all. This PR enforces the following constraints:

- [x] You should not be able to add the same user key as another user
- [x] You should not be able to add a ssh user key which is being used as a deploy key
- [x] You should not be able to add a ssh deploy key which is being used as a user key
- [x] If you add an ssh deploy key to another repository you should be able to use it in different modes without losing the ability to use it in the other mode.
- [x] If you delete a repository you must delete all its deploy keys.

Fix #1357
2019-02-03 23:56:53 +00:00
Lanre Adelowo
c3a6f4a5af show user who created the repository instead of the organization in action feed (#5948) 2019-02-04 01:21:08 +02:00
Lanre Adelowo
888a83fca8 handle milestone events for issues and PR (#5947) 2019-02-03 13:31:58 -05:00
John Olheiser
7e0f977b29 Remove all CommitStatus when a repo is deleted (#5940)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-02-02 23:03:45 -05:00
Sergey Romanov
b66d31e09b fix log output (#5938) 2019-02-02 21:56:15 +00:00
Lanre Adelowo
b1ceecf33e support reviewing on a deleted file path (#5880) 2019-02-01 09:37:20 +08:00
zeripath
450171933c Only allow local login if password is non-empty (#5906) 2019-01-30 23:18:54 +02:00
Lauris BH
056478955e Fix go-get URL generation (#5905) 2019-01-30 21:04:19 +00:00
Lanre Adelowo
f25e696300 Don't discard the value of DISABLE_REGULAR_ORG_CREATION (#5886)
* Consider the configuration value of DISABLE_REGULAR_ORG_CREATION when
creating a user
2019-01-30 12:04:14 -05:00
zeripath
17cdf95691 Also ensure the repo is loaded (#5895)
Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-01-29 22:43:40 +00:00
zeripath
6b8e788bef Ensure issue.Poster is loaded in mailIssueCommentToParticipants (#5891)
Previous code could potentially dereference nil - this PR ensures
that the poster is loaded before dereferencing it.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-01-29 16:26:17 -05:00
Harshit Bansal
14ded78889 Fix an error while adding a dependency via UI. (#5862)
Fixes: #5783
2019-01-27 13:31:40 +02:00
sebastian-sauer
4e60529f4b Config option to disable automatic repo watching (#5852)
Add a new config option to enable / disable the automatic watching of
repos for new repositories and if a user is added to a team.

Fixes #653

Signed-off-by: Sebastian Sauer <sauer.sebastian@gmail.com>
2019-01-27 09:25:21 +00:00
Jakub Arbet
2f2bbce725 Fix failing migration v67 (#5849)
Fixes #5848
2019-01-26 14:50:36 +00:00
yasuokav
c46ec55db5 fix delete correct temp directory (#5839) 2019-01-25 02:54:09 -05:00