summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* [API] Add "before" query to ListIssueComments and ListRepoIssue… (#9685)65432020-01-131-11/+25
| | | | | | | | | * add "before" query to ListIssueComments and ListRepoIssueComments * Add TEST Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* [API] add GET /orgs endpoint (#9560)65432020-01-125-6/+61
| | | | | | | | | | | | | | * introduce `GET /orgs` * add TEST * show also other VisibleType's * update description * refactor a lot * SearchUserOptions by default return only public
* Move create/fork repository from models to modules/repository (#9489)Lunny Xiao2020-01-122-5/+5
| | | | | | | | | | | | | | | | | | | | * Move create/fork repository from models to modules/repository * fix wrong reference * fix test * fix test * fix lint * Fix DBContext * remove duplicated TestMain * fix lint * fix conflicts
* Add owner_name column for table repository for maintaince reason (#9717)Lunny Xiao2020-01-122-5/+3
| | | | | | | | | | | | | | * Add owner_name column for table repository for maintaince reason * refactor * Fix tests * fix test * fix bug when fork repository Co-authored-by: zeripath <art27@cantab.net>
* [BugFix] [API] ​/repos​/issues​/search (#9698)65432020-01-121-12/+16
| | | | | | | | | | * fix * fix options * add TEST Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Allow repo admin to merge PR regardless of review status (#9611)David Svantesson2020-01-114-32/+108
| | | | * Allow repo admin to merge even if review is not ok.
* Move tracked time api convert to convert package (#9665)Lunny Xiao2020-01-101-5/+6
|
* Remove deprecation comment for CreateOrgRepo (#9670)Ryan2020-01-101-1/+0
| | | | Remove mistakenly added `deprecated: true` swagger comment from the `/orgs/{orgr}/repos` handler
* Fix wrong original git service type on a migrated repository (#9693)Lunny Xiao2020-01-102-21/+31
|
* Move pull request api convert to convert package (#9664)Lunny Xiao2020-01-101-4/+5
| | | | | | * Move pull request api convert to convert package * Rename ToPullRequest to ToAPIPullRequest
* [API] creat org repo call same as github (#9186)65432020-01-092-10/+41
| | | | | | | | | | | | | | | * deprecate /api/v1/org/{org}/repos in favour of /api/v1/orgs/{org}/repos + cleanup api repository routes a bit * remove redundant code * use upstream function for api cal * make generate-swagger Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] orgEditTeam make Fields optional (#9556)65432020-01-091-14/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * API: orgEditTeam make Fields optional * add TestCase * Update integrations/api_team_test.go * suggestions from lafriks use len() to check if string is empty Co-Authored-By: Lauris BH <lauris@nix.lv> * change ... * use Where not ID to get mssql * add return and code format * fix test * fix test ... null pointer exept * update specific colums * only specific colums too Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [API] Add notification endpoint (#9488)65432020-01-097-2/+422
| | | | | | | | | | | | | | | | | | | | | | | | | * [API] Add notification endpoints * add func GetNotifications(opts FindNotificationOptions) * add func (n *Notification) APIFormat() * add func (nl NotificationList) APIFormat() * add func (n *Notification) APIURL() * add func (nl NotificationList) APIFormat() * add LoadAttributes functions (loadRepo, loadIssue, loadComment, loadUser) * add func (c *Comment) APIURL() * add func (issue *Issue) GetLastComment() * add endpoint GET /notifications * add endpoint PUT /notifications * add endpoint GET /repos/{owner}/{repo}/notifications * add endpoint PUT /repos/{owner}/{repo}/notifications * add endpoint GET /notifications/threads/{id} * add endpoint PATCH /notifications/threads/{id} * Add TEST * code format * code format
* Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532)David Svantesson2020-01-093-2/+5
| | | | | | | Fix #5997. If a push causes the patch/diff of a PR towards target branch to change, all existing reviews for the PR will be set and shown as stale. New branch protection option to dismiss stale approvals are added. To show that a review is not based on the latest PR changes, an hourglass is shown
* times Add filters (#9373)65432020-01-083-25/+150
| | | | | | | | | (extend #9200) * add query param for GET functions (created Bevore & after) * add test * generalize func GetQueryBeforeSince Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [API] add comments endpoint for single comment (#9494)65432020-01-082-3/+85
| | | | | | | * add GET /repos/{owner}/{repo}/issues/comments/{id} and complete error list for swagger in other func * add repo check
* Move wiki related funtions from models to services/wiki (#9355)Lunny Xiao2020-01-073-23/+26
| | | | * Move wiki related funtions from models to services/wiki
* Branches not at ref commit ID should not be listed as Merged (#9614)zeripath2020-01-073-31/+97
| | | | | | | | | | | 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
* Graceful Queues: Issue Indexing and Tasks (#9363)zeripath2020-01-072-2/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Queue: Add generic graceful queues with settings * Queue & Setting: Add worker pool implementation * Queue: Add worker settings * Queue: Make resizing worker pools * Queue: Add name variable to queues * Queue: Add monitoring * Queue: Improve logging * Issues: Gracefulise the issues indexer Remove the old now unused specific queues * Task: Move to generic queue and gracefulise * Issues: Standardise the issues indexer queue settings * Fix test * Queue: Allow Redis to connect to unix * Prevent deadlock during early shutdown of issue indexer * Add MaxWorker settings to queues * Merge branch 'master' into graceful-queues * Update modules/indexer/issues/indexer.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/indexer/issues/indexer.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/queue/queue_channel.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/queue/queue_disk.go * Update modules/queue/queue_disk_channel.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Rename queue.Description to queue.ManagedQueue as per @guillep2k * Cancel pool workers when removed * Remove dependency on queue from setting * Update modules/queue/queue_redis.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * As per @guillep2k add mutex locks on shutdown/terminate * move unlocking out of setInternal * Add warning if number of workers < 0 * Small changes as per @guillep2k * No redis host specified not found * Clean up documentation for queues * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md * Update modules/indexer/issues/indexer_test.go * Ensure that persistable channel queue is added to manager * Rename QUEUE_NAME REDIS_QUEUE_NAME * Revert "Rename QUEUE_NAME REDIS_QUEUE_NAME" This reverts commit 1f83b4fc9b9dabda186257b38c265fe7012f90df. Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* fix swagger description of reaction API (#9617)65432020-01-061-12/+12
|
* [BugFix] Hide public repos owned by private orgs (#9609)65432020-01-051-0/+1
| | | | | * Restrict AllPublic to actually public repos. * Add new parameter to add in AllLimited Repos
* Fix create bugs (#9606)John Olheiser2020-01-041-2/+3
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix access issues on milestone and issue overview pages. (#9603)David Svantesson2020-01-041-45/+35
| | | | | | * Fix access issues on milestone and issue overview pages. * Fix filter algorithm
* Only serve attachments when linked to issue/release and if accessible by ↵Antoine GIRARD2020-01-053-31/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user (#9340) * test: add current attachement responses * refactor: check if attachement is linked and accessible by user * chore: clean TODO * fix: typo attachement -> attachment * revert un-needed go.sum change * refactor: move models logic to models * fix TestCreateIssueAttachment which was wrongly successful * fix unit tests with unittype added * fix unit tests with changes * use a valid uuid format for pgsql int. test * test: add unit test TestLinkedRepository * refactor: allow uploader to access unlinked attachement * add missing blank line * refactor: move to a separate function repo.GetAttachment * typo * test: remove err test return * refactor: use repo perm for access checking generally + 404 for all reject
* Fix error logged when repos qs is empty (#9591)guillep2k2020-01-031-12/+14
| | | | | | | | | | | * Fix error logged when repos qs is empty * Update routers/user/home.go Co-Authored-By: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add branch protection option to block merge on requested changes. (#9592)David Svantesson2020-01-033-1/+10
| | | | | | | | | | | | | | | | | | | * Add branch protection option to block merge on requested changes. * Add migration step * Fix check to correct negation * Apply suggestions from code review Language improvement. Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Copyright year. Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] dont reqToken on GetReactions (fix #9543) (#9548)65432020-01-022-10/+10
| | | | | | | | * dont reqToken on GetReactions * ctx.Repo.CanWrite has ctx.User.IsAdmin in It Co-authored-by: Lauris BH <lauris@nix.lv>
* Dont trigger notification twice on issue assignee change (#9582)65432020-01-021-4/+1
|
* Fix #9189 - API Allow only specific Colums to be updated on Issue (#9539)65432020-01-012-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dont insert "-1" in any case to issue.poster_id * Make sure API cant override importand fields * code format * fix lint * WIP test * add missing poster_id * fix test * user.IsGhost handle nil * CI.restart() * make sure no -1 is realy added * CI.restart() * @lunny suggestion remove some not allowed fields * seperate issue.LoadMilestone * load milestone and return it on IssueEdit via API * extend Test for TestAPIEditIssue * fix fixtures * declare allowedColumnsUpdateIssueByAPI only once * Update Year * no var just write id drecty into func cal Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] Fix 9544 | return 200 when reaction already exist (#9550)65432019-12-313-37/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add ErrReactionAlreadyExist * extend CreateReaction * reaction already exist = 200 * extend FindReactionsOptions * refactor swagger options/definitions * fix swagger-validate * Update models/error.go Co-Authored-By: zeripath <art27@cantab.net> * fix test PART1 * extend FindReactionsOptions with UserID option * catch error on test * fix test PART2 * format ... Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
* Change markdown rendering from blackfriday to goldmark (#9533)zeripath2019-12-311-5/+0
| | | | | | | | | | | | | | | | | | | * Move to goldmark Markdown rendering moved from blackfriday to the goldmark. Multiple subtle changes required to the goldmark extensions to keep current rendering and defaults. Can go further with goldmark linkify and have this work within markdown rendering making the link processor unnecessary. Need to think about how to go about allowing extensions - at present it seems that these would be hard to do without recompilation. * linter fixes Co-authored-by: Lauris BH <lauris@nix.lv>
* [BugFix] use default avatar for ghost user (fix 500 error) (#9536)65432019-12-291-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | * remove since it is there for 3years * fix 500 error for ghost avatar * dont insert "-1" in any case to issue.poster_id * fix lint * Test: ghost avatar link * fix test * Revert "remove since it is there for 3years" This reverts commit fd9ad05159c84ba804b126d2a959963d82578b22. * Revert "dont insert "-1" in any case to issue.poster_id" This reverts commit 05469ab6d815a6cc6478a256018b9ed1a12749e0. Co-authored-by: zeripath <art27@cantab.net>
* remove since it is there for 3years (#9538)65432019-12-291-18/+0
|
* [Fix] Release attachment should use DownloadURL() not Name (#9529)65432019-12-281-1/+1
| | | | | | | * Handle if two or more attachments have the same name * previously only the first could be downloaded - now each is downloadable * dos also take care of #6506 (fix was: #6512) * use func DownloadURL() at issue attatchments too
* Fix repository issues pagination bug when there are more than one label ↵Lunny Xiao2019-12-281-1/+2
| | | | filter (#9512)
* Stop various tests from adding to the source tree (#9515)zeripath2019-12-281-0/+30
| | | | | | | Instead of just adding test generated files to .gitignore prevent them from being produced in the first place. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [Fix] AllowedReaction code (#9518)65432019-12-272-2/+0
| | | | | | | | | * optimize * CI.restart() Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net>
* [API] Extend times API (#9200)65432019-12-273-33/+223
| | | | | Extensively extend the times API. close #8833; close #8513; close #8559
* Remove obsolete file private/push_update.go (#9503)David Svantesson2019-12-261-56/+0
|
* Push update after branch is restored (#9416)Mario Lubenka2019-12-261-0/+16
| | | | | | | | | | | | | * Push update after branch is restored Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Apply suggestions from code review Use name from deletedBranch Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Batch hook pre- and post-receive calls (#8602)zeripath2019-12-262-172/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * make notifyWatchers work on multiple actions * more efficient multiple notifyWatchers * Make CommitRepoAction take advantage of multiple actions * Batch post and pre-receive results * Set batch to 30 * Auto adjust timeout & add logging * adjust processing message * Add some messages to pre-receive * Make any non-200 status code from pre-receive an error * Add missing hookPrintResults * Remove shortcut for single action * mistaken merge fix * oops * Move master branch to the front * If repo was empty and the master branch is pushed ensure that that is set as the default branch * fixup * fixup * Missed HookOptions in setdefaultbranch * Batch PushUpdateAddTag and PushUpdateDelTag Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Trigger webhook when deleting a branch after merging a PR (#9424)Brad Albright2019-12-251-0/+16
| | | | | | | | | * fixed so when deleting a branch after merging a PR, a webhook is triggered * changed to use pr.HeadRepo instead of ctx.Repo when sending webhook for a deletion of branch after merging pr Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* adding calls to issue.LoadRepo() prior to calling issue.HTMLURL() (#9484)Brad Albright2019-12-251-0/+10
|
* [API] Extend contents with dates (#9464)65432019-12-242-0/+34
| | | | | | | | | | | | | | | * extend CommitTree func * make sure Date NOT nil * spell corection Co-Authored-By: zeripath <art27@cantab.net> * add TEST Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Use Req.URL.RequestURI() to cope with FCGI urls (#9473)zeripath2019-12-243-3/+5
| | | | | * Use Req.URL.RequestURI() to cope with FCGI urls * Add debug logging statement when forbidden in internal API.
* Prefix all user-generated IDs in markup (#9477)John Olheiser2019-12-231-2/+2
| | | | | | | | | | * Prefix all user-generated IDs in markup * Add user-content- to IDs in unit-tests * fixup markdown_test.go * update the hrefs for the wiki test * Add blackfriday extension regex Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Refactor code indexer (#9313)Lunny Xiao2019-12-233-7/+7
| | | | | | | | | | | | | | | | | | | | * Refactor code indexer * fix test * fix test * refactor code indexer * fix import * improve code * fix typo * fix test and make code clean * fix lint
* Swagger info corrections (#9441)65432019-12-2050-638/+1018
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * use numbers and not http.Status___ enum * fix test * add many missing swagger responses * code format * Deletion Sould return 204 ... * error handling improvements * if special error type ... then add it to swagger too * one smal nit * invalidTopicsError is []string * valid swagger specification 2.0 - if you add responses swagger can tell you if you do it right :+1: * use ctx.InternalServerError * Revert "use numbers and not http.Status___ enum" This reverts commit b1ff386e2418ed6a7f183e756b13277d701278ef. * use http.Status* enum everywhere
* Response for context on retry database connection (#9444)Lunny Xiao2019-12-201-0/+6
|
* Fix NewCommitStatus (#9434)John Olheiser2019-12-191-2/+2
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>