Commit graph

26 commits

Author SHA1 Message Date
zeripath
56ae539bed SearchRepositoryByName improvements and unification (#6897) 2019-05-15 11:24:39 -04:00
Lunny Xiao
34eee25bd4
Move sdk structs to modules/structs (#6905)
* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
2019-05-11 18:21:34 +08:00
Segev Finer
34548369e1 Add API for manipulating Git hooks (#6436)
* Add API for manipulating Git hooks

Signed-off-by: Segev Finer <segev@codeocean.com>

* Replace code.gitea.io/sdk with PR branch temporarily for CI

* Switch back to code.gitea.io/sdk@master

* Return 403 instead of 404 on no permission to edit hooks in API

* Add tests for Git hooks API

* Update models/repo_list_test.go

Co-Authored-By: segevfiner <segev208@gmail.com>

* Update models/repo_list_test.go

Co-Authored-By: segevfiner <segev208@gmail.com>

* empty line
2019-04-17 01:31:08 -04:00
Mura Li
3186ef554c Support search operators for commits search (#6479)
* Support searching commits with prefix syntax

For now, support auther: committer:
When more than one prefix is supplied is presented, the result is the union.
When different prefixes are supplied, the result is the intersection.

For example,
"author:alice author:bob"
=> the result is all commits authored by Alice OR Bob

"hello committer:alice"
=> the result is all commits committed by Alice AND has the keyword
'hello' in the message.

Note that there should NOT have any space after the colon(:) of the prefix.
For example,
"author:bill" => correct
"author: bill" => wrong

* Remove unneeded logging

* Add missing files of test repository

* Add missing repo_unit entries to test fixtures

* Update test cases

* Add tooltip for commits search button

* Update tooltip text

I have no idea about how to format it with line breaks.

* Make the usage example more real

* Add a test case

* Add new options struct for SearchCommits

* Prefer len(s) > 0 over s != ""

* Add NewSearchCommitsOptions
2019-04-12 10:28:44 +08:00
Bogdan Petrea
583968f274 Return 409 when creating repo if it already exists. (#6330) 2019-03-15 10:19:09 -04:00
Lunny Xiao
eabbddcd98
Restrict permission check on repositories and fix some problems (#5314)
* fix units permission problems

* fix some bugs and merge LoadUnits to repoAssignment

* refactor permission struct and add some copyright heads

* remove unused codes

* fix routes units check

* improve permission check

* add unit tests for permission

* fix typo

* fix tests

* fix some routes

* fix api permission check

* improve permission check

* fix some permission check

* fix tests

* fix tests

* improve some permission check

* fix some permission check

* refactor AccessLevel

* fix bug

* fix tests

* fix tests

* fix tests

* fix AccessLevel

* rename CanAccess

* fix tests

* fix comment

* fix bug

* add missing unit for test repos

* fix bug

* rename some functions

* fix routes check
2018-11-28 19:26:14 +08:00
Daniel Balko
3379141d81 API: '/orgs/:org/repos': return private repos with read access (#5310) (#3829) (#5383)
Signed-off-by: Daniel Balko <inxonic+github@gmail.com>
2018-11-23 16:23:27 -05:00
Bo-Yi Wu
ea20adaa84
feat(repo): support search repository by topic name (#4505)
* feat(repo): support search repository by topic name
2018-09-13 10:33:48 +08:00
B-OnTheGo
e47df0b301 Enforce token on api routes [fixed critical security issue #4357] (#4840) 2018-09-10 12:15:52 -04:00
SagePtr
bf55276189 Fix redirect with non-ascii branch names (#4764) (#4810)
* Fix redirect with non-ascii branch names (#4764)

* Add integration tests for non-ascii branch redirect

* Fix mysql test and coverage test
2018-09-06 21:37:02 -04:00
Lauris BH
69e2ab1611 Allow administrator to create repository for any organization (#4368) 2018-07-05 01:51:02 +02:00
Lauris BH
4a8ee0b5cc
Check that repositories can only be migrated to own user or organizations (#4366)
* Repositories can only migrated to own user or organizations

* Add check for organization that user does not belong to

* Allow admin to migrate repositories for other users
2018-07-05 01:45:15 +03:00
David Schneiderbauer
0b3ea42847 hide issues from org private repos w/o team assignment (#4034) 2018-06-21 12:00:13 -04:00
Morlinest
ddb7f59ef4 Add search mode option to /api/repo/search (#2756)
* Add repo type option to /api/repo/search

* Add tests and fix result of collaborative filter in specific condition

* Fix/optimize search & tests

* Improve integration tests

* Fix lint errors

* Fix unit tests

* Change and improve internal implementation of repo search

* Use NonexistentID

* Make search api more general

* Change mirror and fork search behaviour

* Fix tests & typo in comment
2017-10-27 00:16:13 +03:00
Morlinest
ccd3577970 Fix repository search function (#2689)
* Fix and remove FIXME

* Respect membership visibility

* Fix/rewrite searchRepositoryByName function

* Add unit tests

* Add integration tests

* Remove Searcher completely

* Remove trailing space
2017-10-17 23:20:22 +08:00
Morlinest
c2346e4469 Add repository search unit and integration tests (#2575)
* Add more repo search tests

* Fix repo search tests

* Always test returned repos length

* Add test with lower pagesize limit (test more pages)

* Add and fix /api/repo/search integration tests

* Simplify unit tests code

* Simplify and unify integration tests code

* Improve test coverage

* Temporary fix tests due to bugs in current repo search implementation

* Revert removing not nil Searcher

* Add more checks to tests

* Simplify privacy checks in /api/repo tests

* Temporary remove privacy check from repo search tests
2017-10-10 09:23:29 +08:00
Morlinest
80b430d7c0 Fix /api/repo/search integration tests (#2550) 2017-09-20 12:24:38 +03:00
Ethan Koenig
49df677c47 Check for access in /repositories/:id (#2227)
* Check for access in /repositories/:id

* Integration test
2017-07-30 09:13:33 +08:00
Aaron Walker
6a3c03762a API: support '/orgs/:org/repos' (#2047)
* API: support '/orgs/:org/repos'
2017-07-13 13:14:15 +02:00
Ethan Koenig
93a1de4842 Fix repo API bug (#2133)
Don't require token when not necessary
2017-07-12 03:23:41 +02:00
Ethan Koenig
8f1d62ad3b Fix GET /users/:username/repos endpoint (#2125) 2017-07-10 14:07:39 +03:00
Ethan Koenig
f1adaef458 Less verbose integration tests (#2123)
* Helper functions for intergration test boilerplate
2017-07-07 21:36:47 +02:00
Ethan Koenig
4c0e567062 Fix improper setup for integration tests (#2050) 2017-06-25 17:34:30 +08:00
Ethan Koenig
61716bd8f7 Display URLs in integration test logs (#1924) 2017-06-09 19:41:36 -05:00
Lunny Xiao
0308d44a16 fix #1643 and improve integration test (#1645) 2017-04-30 13:08:09 +08:00
Lunny Xiao
61b08b5c01 bug fixed for API to get user's repos (#1622)
* bug fixed for API to get user's repos

* add tests and fix another place

* test user2 since user1 has no repos
2017-04-29 12:33:25 +08:00