aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
Commit message (Collapse)AuthorAgeFilesLines
* Move create issue comment to comments package (#8212)Lunny Xiao2019-09-241-3/+4
| | | | | | | | | | * move create issue comment to comments package * extract actions on update/delete comment from models to comment service * fix lint * fix lint
* Move all mail related codes from models to services/mailer (#7200)Lunny Xiao2019-09-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move all mail related codes from models to modules/mailer * fix lint * use DBContext instead Engine * use WithContext not WithEngine * Use DBContext instead of Engine * don't use defer when sess.Close() * move DBContext to context.go and add some methods * move mailer from modules/ to services * fix lint * fix tests * fix fmt * add gitea copyright * fix tests * don't expose db functions * make code clear * add DefaultDBContext * fix build * fix bug
* Add teams to repo on collaboration page. (#8045)David Svantesson2019-09-232-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add teams to repo on collaboration page. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add option for repository admins to change teams access to repo. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add comment for functions Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make RepoAdminChangeTeamAccess default false in xorm and make it default checked in template instead. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make proper language strings and fix error redirection. * Add unit tests for adding and deleting team from repository. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add database migration Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix redirect Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix locale string mismatch. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Move team access mode text logic to template. * Move collaborator access mode text logic to template.
* Refuse merge until all required status checks success (#7481)Lunny Xiao2019-09-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * refuse merge until ci successfully * deny merge request when required status checkes not succeed on merge Post and API * add database migration for added columns on protected_branch * fix migration * fix protected branch check bug * fix protected branch settings * remove duplicated code on check pull request's required commit statuses pass * remove unused codes * fix migration * add newline for template file * fix go mod * rename function name and some other fixes * fix template * fix bug pull view * remove go1.12 wrong dependencies * add administrator bypass when protected branch status check enabled * fix bug * improve the codes
* move some milestone functions to a standalone package (#8213)Lunny Xiao2019-09-182-2/+4
|
* Remove legacy handling of drone token (#8191)techknowlogick2019-09-171-6/+0
| | | Now Drone has removed Gitea user/pass handling we can remove legacy handling
* Move create release from models to a standalone package (#7539)Lunny Xiao2019-09-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | * move create release from models to a standalone package * fix lint * fix comment year * fix lint * fix lint * fix package import name * fix vendor * fix go mod * some refactors * fix vendor * use go1.12 make vendor * fix vendor
* Fix team user api (#8172)Lunny Xiao2019-09-151-0/+9
| | | | | | | | | | | | | | | | * fix team user api * fix tests * fix api * fix team user api * change user convert * fix tests * fix tests
* Implement webhook branch filter (#7791)WGH2019-09-091-0/+2
| | | | | | | | * Fix validate() function to handle errors in embedded anon structs * Implement webhook branch filter See #2025, #3998.
* Add option to initialize repository with labels (#6061)John Olheiser2019-09-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add optional label sets on repo creation * Fix CRLF * Instead of hardcoding default, make it the helper * Move label set init out of repo init Add a new error for the router Combine router label init with repo creation label init Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add issue labels to Swagger for repo creation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update models/issue_label.go Co-Authored-By: Lauris BH <lauris@nix.lv> * Update models/issue_label.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Add API endpoint for accessing repo topics (#7963)David Svantesson2019-09-036-42/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Create API endpoints for repo topics. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Generate swagger Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add documentation to functions Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Grammar fix Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix function comment Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Can't use FindTopics when looking for a single repo topic, as it doesnt use exact match Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add PUT ​/repos​/{owner}​/{repo}​/topics and remove GET ​/repos​/{owner}​/{repo}​/topics * Ignore if topic is sent twice in same request, refactoring. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix topic dropdown with api changes. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Style fix Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Update API documentation Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Better way to handle duplicate topics in slice Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make response element TopicName an array of strings, instead of using an array of TopicName Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add test cases for API Repo Topics. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix format of tests Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix comments Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix unit tests after adding some more topics to the test fixture. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Update models/topic.go Limit multiple if else if ... Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> * Engine as first parameter in function Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> * Replace magic numbers with http status code constants. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix variable scope Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Test one read with login and one with token Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add some more tests Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Apply suggestions from code review Use empty struct for efficiency Co-Authored-By: Lauris BH <lauris@nix.lv> * Add test case to check access for user with write access Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix access, repo admin required to change topics Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Correct first test to be without token Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Any repo reader should be able to access topics. * No need for string pointer Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
* Retry create issue to cope with duplicate keys (#7898)guillep2k2019-08-261-7/+0
| | | | | | * Retry create issue to cope with duplicate keys * Use .SetExpr().Where().Insert()
* Adds details about what tags can use the Git tags API (#7989)Richard Mahn2019-08-261-2/+2
|
* API method to list all commits of a repository (#6408)Mike Schwörer2019-08-263-26/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added API endpoint ListAllCommits (/repos/{owner}/{repo}/git/commits) Signed-off-by: Mike Schwörer <mailport@mikescher.de> * Fixed failing drone build Signed-off-by: Mike Schwörer <mailport@mikescher.de> * Implemented requested changes (PR reviews) Signed-off-by: Mike Schwörer <mailport@mikescher.de> * gofmt Signed-off-by: Mike Schwörer <mailport@mikescher.de> * Changed api route from "/repos/{owner}/{repo}/git/commits" to "/repos/{owner}/{repo}/commits" * Removed unnecessary line * better error message when git repo is empty * make generate-swagger * fixed removed return * Update routers/api/v1/repo/commits.go Co-Authored-By: Lauris BH <lauris@nix.lv> * Update routers/api/v1/repo/commits.go Co-Authored-By: Lauris BH <lauris@nix.lv> * go fmt * Refactored common code into ToCommit() * made toCommit not exported * added check for userCache == nil
* Run CORS handler first for /api routes (#7967)Tamal Saha2019-08-261-8/+1
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* Include description in repository search. (#7942)David Svantesson2019-08-251-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add description in repository search. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Refactor SearchRepositoryByName with a general function SearchRepository Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Allow to specify if description shall be included in API repo search. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add new app.ini setting for whether to search within repo description. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Search keyword in description (if setting enabled) on: - Explore page - Organization profile page - User profile page - Admin repo page Do not search keyword in description on: - Any non-keyword search (not relevant) - Incremental search (uses API) Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Put parameters related to keyword directly after it Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add test cases for including (and not including) repository description in search. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Rename test function from TestSearchRepositoryByName to TestSearchRepository. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make setting SEARCH_REPO_DESCRIPTION default to true Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
* Document possibility to limit API Repo search to topics only. (#7957)David Svantesson2019-08-231-0/+4
| | | Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
* Use gitea forked macaron (#7933)Tamal Saha2019-08-2335-58/+29
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* Display ui time with customize time location (#7792)Lunny Xiao2019-08-153-15/+15
| | | | | | | | | | | | | | | | | | * display ui time with customize time location * fix lint * rename UILocation to DefaultUILocation * move time related functions to modules/timeutil * fix tests * fix tests * fix build * fix swagger
* Rewrite existing repo units if setting is not included in api body (#7763)David Svantesson2019-08-101-73/+86
| | | | | | | | * Rewrite existing repo units if setting is not included in api body Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * else-if on one row
* api: fix multiple bugs with statuses endpoints (#7785)Antoine GIRARD2019-08-092-10/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | * fix commit statuses api url * search refs before passing sha * adjust tests * directly search tags and branches names + remove un-needed check in NewCommitStatus * fix comment * de-duplicate code * test: use relative setting.AppURL * Update routers/api/v1/repo/status.go Co-Authored-By: Lauris BH <lauris@nix.lv> * remove return * Update routers/api/v1/repo/status.go Co-Authored-By: Lauris BH <lauris@nix.lv>
* add pagination for admin api get orgs and fix only list public orgs bug (#7742)Lunny Xiao2019-08-041-1/+12
|
* fix wrong email when use gitea as OAuth2 provider (#7640)renothing2019-07-2711-23/+28
| | | | | | | when you use gitea as OAuth2 provider, the /api/v1/user should return user primary email as identifier, which is unique in OAuth2 clients. this patch use convert.ToUser replace all u.APIFormat in api requests, return primary email when caller is yourself or admin.
* Fix #7136: Add paging and extend API GetCommitStatuses (#7141)zeripath2019-07-251-5/+46
| | | | | | | | | | | | | | | | | | | | * Fix #7136: Add paging and extend API GetCommitStatuses * update swagger * Update routers/api/v1/repo/status.go Co-Authored-By: techknowlogick <matti@mdranta.net> * Update routers/api/v1/repo/status.go Co-Authored-By: techknowlogick <matti@mdranta.net> * Update routers/api/v1/repo/status.go Co-Authored-By: techknowlogick <matti@mdranta.net> * Apply suggestions from code review
* Swagger: Add information to API Token header (#7585)zeripath2019-07-241-0/+1
| | | * Add a description to the API Token header for swagger
* Fixes #7564 - Malformed URLs in API git/commits response (#7565)Richard Mahn2019-07-221-2/+2
|
* add notification placeholder (#7409)Lunny Xiao2019-07-121-0/+5
|
* Refactor filetype is not allowed errors (#7309)Antoine GIRARD2019-07-061-16/+4
|
* fix api route (#7346)Lunny Xiao2019-07-031-4/+4
|
* Add commit statuses reports on pull request view (#6845)Lunny Xiao2019-06-301-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add commit statuses reports on pull view * Add some translations * improve the UI * fix fmt * fix tests * add a new test git repo to fix tests * fix bug when headRepo or headBranch missing * fix tests * fix tests * fix consistency * fix tests * fix tests * change the test repo * fix tests * fix tests * fix migration * keep db size consistency * fix translation * change commit hash status table unique index * remove unused table * use char instead varchar * make hashCommitStatusContext private * split merge section with status check on pull view ui * fix tests; fix arc-green theme on pull ui
* Fixes #7292 - API File Contents bug (#7301)Richard Mahn2019-06-293-16/+55
|
* Fixes #7152 - Allow create/update/delete message to be empty, use default ↵Richard Mahn2019-06-291-0/+13
| | | | | | | | | | message (#7324) * Fixes #7152 - Allow create/update/delete message to be empty, use default message * Linting fix * Fix to delete integration tests
* Fixes #7238 - Annotated tag commit ID incorrect (#7321)Richard Mahn2019-06-291-1/+1
| | | | | | * Fixes #7238 - Annotated tag commit ID incorrect * Fixes #7238 - Annotated tag commit ID incorrect
* Fix #732: Add LFS objects to base repository on merging (#7082)zeripath2019-06-221-1/+2
| | | | On merge we walk the merge history and ensure that all lfs objects pointed to in the history are added to the base repository. This switches from relying on having git-lfs installed on the server, (and in fact .gitattributes being correctly installed.)
* Add missing description of label on API (#7159)Lunny Xiao2019-06-161-3/+7
| | | | | | | | * add missing description of label on API * fix comment head * fix swagger
* Add LastLogin to the User API (#7196)zeripath2019-06-151-0/+2
|
* Add golangci (#6418)kolaente2019-06-124-21/+32
|
* Fixes #2738 - Adds the /git/tags API endpoint (#7138)Richard Mahn2019-06-085-31/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fixes #2738 - /git/tags API * proper URLs * Adds function comments * Updates swagger * Removes newline from tag message * Removes trailing newline from commit message * Adds integration test * Removed debugging * Adds tests * Fixes bug where multiple tags of same commit show wrong tag name * Fix formatting * Removes unused varaible * Fix to annotated tag function names and response * Update modules/git/repo_tag.go Co-Authored-By: Lauris BH <lauris@nix.lv> * Uses TagPrefix * Changes per review, better error handling for getting tag and commit IDs * Fix to getting commit ID * Fix to getting commit ID * Fix to getting commit ID * Fix to getting commit ID
* Compare branches, commits and tags with each other (#6991)Mario Lubenka2019-06-071-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Supports tags when comparing commits or branches Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Hide headline when only comparing and don't load unused data Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Merges compare logics to allow comparing branches, commits and tags with eachother Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Display branch or tag instead of commit when used for comparing Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Show pull request form after click on button Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Transfers relevant pull.go changes from master to compare.go Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Fixes error when comparing forks against a commit or tag Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes console.log from JavaScript file Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Show icon next to commit reference when comparing branch or tag Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Updates css file Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Fixes import order * Renames template variable * Update routers/repo/compare.go Co-Authored-By: zeripath <art27@cantab.net> * Update from master Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Allow short-shas in compare * Renames prInfo to compareInfo Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check PR permissions only if compare is pull request Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adjusts comment Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use compareInfo instead of prInfo
* Add state param to milestone listing API (#7131)Lanre Adelowo2019-06-061-2/+6
| | | | | | | | | | | | | | | | * Support state params * update tests * fix tests * add state=all support * update tests * update swagger * update swagger
* Fixes #7023 - API Org Visibility (#7028)Richard Mahn2019-05-304-5/+23
|
* Fixes #5960 - Adds API Endpoint for Repo Edit (#7006)Richard Mahn2019-05-304-1/+364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Feature - #5960 - API Endpoint for Repo Editing * Revert from merge * Adds integration testing * Updates to integration tests * Revert changes * Update year in file header * Misspell fix * XORM = test * XORM = test * revert XORM = file * Makes RepoUnit.ID be pk and autoincr * Fix to units * revert header * Remove print statement * Adds other responses * Improves swagger for creating repo * Fixes import order * Better Unit Type does not exist error * Adds editable repo properties to the response repo structure * Fix to api_repo_edit_test.go * Fixes repo test * Changes per review * Fixes typo and standardizes comments in the EditRepoOption struct for swagger * Fixes typo and standardizes comments in the EditRepoOption struct for swagger * Actually can unarchive through the API * Unlike delete, user doesn't have to be the owner of the org, just admin to the repo * Fix to swagger comments for field name change * Update to swagger docs * Update swagger * Changes allow_pull_requests to has_pull_requests
* Fix index produces problem when issues/pulls deleted (#6973)Lunny Xiao2019-05-181-1/+7
| | | | | | | | | | * fix index produces problem when issues/pulls deleted * fix tests * fix tests * fix tests
* SearchRepositoryByName improvements and unification (#6897)zeripath2019-05-151-36/+13
|
* Webhook Logs show proper HTTP Method, and allow change HTTP method in form ↵techknowlogick2019-05-151-0/+1
| | | | | | | | | | | (#6953) * Fix #6951 - logs show proper HTTP Method, and allow change HTTP method in form * enforce POST method for webhook * set default if method is empty
* Handle CORS requests (#6289)Tamal Saha2019-05-131-2/+19
|
* Change drone token name to let users know to use oauth2 (#6912)techknowlogick2019-05-121-3/+10
|
* Move sdk structs to modules/structs (#6905)Lunny Xiao2019-05-1152-53/+53
| | | | | | | | | | | | * move sdk structs to moduels/structs * fix tests * fix fmt * fix swagger * fix vendor
* Fixes #6881 - API users search fix (#6882)Richard Mahn2019-05-082-2/+2
|
* Fix 404 when send pull request some situation (#6871)Lunny Xiao2019-05-071-8/+26
|