summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* [Vendor] Switch go-version lib (#12719)65432020-09-052-4/+5
| | | | | | | | | | | | | | | | | | | | | * vendor: switch from "mcuadros/go-version" to "hashicorp/go-version" * Adapt P1 * simplify * fix lint * adapt * fix lint & rm old code * no deadlock * rm RWMutex and check GoVersion only 1-time * Copyright header Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Expose Attachemnt Settings by API (#12514)65432020-09-053-0/+26
| | | close #12368
* API: Expose its limitation settings (#12714)65432020-09-043-0/+26
| | | | | | | | * API: Expose its limitation settings * TESTs Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [BugFix] Fix comment broken issue ref dependence (#12651)65432020-09-041-2/+4
| | | | | | | | | | | | | * deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too * Ignore ErrIssueNotExist on comment.LoadDepIssueDetails() * Add migration * Ignore 'dependent_issue_id = 0' case * exchange as per @lunny Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Remove duplicate logic in initListSubmits (#12660)赵智超2020-09-021-6/+8
| | | | | | | | | | | | | | | | | | * Remove duplicate logic in initListSubmits Using the same logic to handle Choosing reviewers and assignees as choosing label. It's the first step of #10926. Signed-off-by: a1012112796 <1012112796@qq.com> * fix choose block * fix nit * try fix bug * simple code Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Rename models.ProtectedBranchRepoID to models.EnvRepoID and ensure ↵zeripath2020-08-302-1/+16
| | | | | | EnvPusherEmail is set (#12646) Signed-off-by: Andrew Thornton <art27@cantab.net>
* Do not disable commit changes button on repost (#12644)zeripath2020-08-291-0/+1
| | | | | | | | If the user has pressed commit changes and the post has failed - do not disable the commit changes button. Fix #12072 Signed-off-by: Andrew Thornton <art27@cantab.net>
* [API] Delete Token accept names too (#12366)65432020-08-283-7/+38
| | | | | | | | * Delete Token accept names too * better description Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Set context for running CreateArchive in to that of the request (#12555)zeripath2020-08-281-1/+1
| | | | | | | | | | Set the context for CreateArchive to that of the request to ensure that archives are only built for as long as a request is requesting them Fix #11551 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Escape more things that are passed through str2html (#12622)zeripath2020-08-281-2/+3
| | | | | | | | | | | | | | * Escape more things that are passed through str2html Signed-off-by: Andrew Thornton <art27@cantab.net> * Bloody editors! Co-authored-by: mrsdizzie <info@mrsdizzie.com> * Update routers/user/oauth.go Co-authored-by: mrsdizzie <info@mrsdizzie.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Git migration UX (#12619)John Olheiser2020-08-281-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Implementation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix gitlab and token cloning Signed-off-by: jolheiser <john.olheiser@gmail.com> * Imports and JS Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Linting Signed-off-by: jolheiser <john.olheiser@gmail.com> * Generate swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move mirror toggle and rename options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add cron running API (#12421)zeripath2020-08-243-0/+106
| | | | | | | | | | | | | | | | | | | * Add cron running API Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review * placate-swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * return not found Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix signing.wont_sign.%!s(<nil>) if Require Signing commits but not signed ↵zeripath2020-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | in (#12581) signing.wont_sign.%!s(<nil>) will be displayed if the repository needs signed commits but the user is not logged in. This is displayed because of complicated logic in the the template repo/issue/view_content/pull.tmpl and a shortcut in the code of routers/repo/issue.go This PR adds a default value of notsignedin if users are not signed in, which although our templates will not show will prevent custom templates from showing the above. It also fixes the template to avoid showing signing errors if the user is not authorized to sign. Replaces #12564 Close #12564 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Initial support for push options (#12169)John Olheiser2020-08-231-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial support for push options Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix misspelling 🤦 Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix formatting after conflict resolution * defer close git repo * According the GitLab documentation, git >= 2.10 Signed-off-by: jolheiser <john.olheiser@gmail.com> * Words are hard. Thanks @mrsdizzie :sweat_smile: Co-authored-by: mrsdizzie <info@mrsdizzie.com> * Only update if there are push options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Hide 'New Project board' button for users that are not signed in (#12547)wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf2020-08-222-22/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | * hide: 'New Project board' button * there is no reason to show the button for users that are not signed in * update template: specifies the condition together with another one as per lafriks' suggestion in the comment * chore: add proper user authorization check * chore: also hide button if repo is archived * chore: show project board edit/delete menu to authorized users only * chore: drop the redundant IsSigned check * CanWriteIssues and CanWritePulls implies (and requires) signed in user * Add CanWriteProjects and properly assert permissions Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Allow addition of gpg keyring with multiple keys (#12487)zeripath2020-08-212-4/+12
| | | | | | | Related #6778 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix typos (#12542)Gjergji Ramku2020-08-203-4/+4
| | | Signed-off-by: Gjergji Ramku <gjergjiramku@gmail.com>
* Show 2FA info on Admin Pannel: Users List (#12515)65432020-08-201-0/+1
|
* Report error if API merge is not allowed (#12528)zeripath2020-08-191-3/+13
| | | | | | | | | | #12496 demonstrated that the API merge needs to return some information as to why a merge has been disallowed with a status code 422. This PR ensures that a reason is always returned. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add a storage layer for attachments (#11387)Lunny Xiao2020-08-187-17/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a storage layer for attachments * Fix some bug * fix test * Fix copyright head and lint * Fix bug * Add setting for minio and flags for migrate-storage * Add documents * fix lint * Add test for minio store type on attachments * fix test * fix test * Apply suggestions from code review Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> * Add warning when storage migrated successfully * Fix drone * fix test * rebase * Fix test * display the error on console * Move minio test to amd64 since minio docker don't support arm64 * refactor the codes * add trace * Fix test * remove log on xorm * Fi download bug * Add a storage layer for attachments * Add setting for minio and flags for migrate-storage * fix lint * Add test for minio store type on attachments * Apply suggestions from code review Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> * Fix drone * fix test * Fix test * display the error on console * Move minio test to amd64 since minio docker don't support arm64 * refactor the codes * add trace * Fix test * Add URL function to serve attachments directly from S3/Minio * Add ability to enable/disable redirection in attachment configuration * Fix typo * Add a storage layer for attachments * Add setting for minio and flags for migrate-storage * fix lint * Add test for minio store type on attachments * Apply suggestions from code review Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> * Fix drone * fix test * Fix test * display the error on console * Move minio test to amd64 since minio docker don't support arm64 * don't change unrelated files * Fix lint * Fix build * update go.mod and go.sum * Use github.com/minio/minio-go/v6 * Remove unused function * Upgrade minio to v7 and some other improvements * fix lint * Fix go mod Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Tyler <tystuyfzand@gmail.com>
* Kanban board (#8346)Lanre Adelowo2020-08-169-44/+775
| | | | | | | | | | | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: jaqra <48099350+jaqra@users.noreply.github.com> Co-authored-by: Kerry <flatline-studios@users.noreply.github.com> Co-authored-by: Jaqra <jaqra@hotmail.com> Co-authored-by: Kyle Evans <kevans91@users.noreply.github.com> Co-authored-by: Tsakiridis Ilias <TsakiDev@users.noreply.github.com> Co-authored-by: Ilias Tsakiridis <ilias.tsakiridis@outlook.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix bug preventing transfer to private organization (#12497)zeripath2020-08-162-2/+11
| | | | | | | | | | | | | | | | | * Fix bug preventing transfer to private organization The code assessing whether a private organization was visible to a user before allowing transfer was incorrect due to testing membership the wrong way round This PR fixes this issue and renames the function performing the test to be clearer. Further looking at the API for transfer repository - no testing was performed to ensure that the acting user could actually see the new owning organization. Signed-off-by: Andrew Thornton <art27@cantab.net> * change IsUserPartOfOrg everywhere
* Add Access-Control-Expose-Headers (#12446)zeripath2020-08-1312-0/+16
| | | | | | Fix #12424 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
* Fix ignored login on compare (#12476)Lunny Xiao2020-08-121-1/+1
|
* Re-attempt to delete temporary upload if the file is locked by another ↵zeripath2020-08-116-8/+59
| | | | | | | | | | | process (#12447) Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util. Fix #12339 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
* Render the git graph on the server (#12333)zeripath2020-08-061-2/+9
| | | | | | | | | | | | | Rendering the git graph on the server means that we can properly track flows and switch from the Canvas implementation to a SVG implementation. * This implementation provides a 16 limited color selection * The uniqued color numbers are also provided * And there is also a monochrome version *In addition is a hover highlight that allows users to highlight commits on the same flow. Closes #12209 Signed-off-by: Andrew Thornton art27@cantab.net Co-authored-by: silverwind <me@silverwind.io>
* UserProfile Page: Render Description (#12415)65432020-08-051-0/+5
| | | | | | | | | | | | | * If Description contain more that one line render it * simpler ... * only render if description exists * Fix NPE in tests * Update routers/user/profile.go Co-authored-by: zeripath <art27@cantab.net>
* Prevent empty div when editing comment (#12404)zeripath2020-08-041-3/+3
| | | | | | | | * Prevent empty div when editing comment The template for attachments needs to remove whitespace and return empty when there are no attachments. Fix #10220
* Add API to update pr headBranch (#12419)赵智超2020-08-043-1/+98
| | | | | * [API] Add update pr headBranch api Signed-off-by: a1012112796 <1012112796@qq.com>
* fix a small nit (#12420)赵智超2020-08-031-0/+1
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* Add TOTP header to Swagger Documentation (#12402)65432020-08-021-0/+6
|
* Don't use legacy method to send Matrix Webhook (#12348)S7evinK2020-07-301-0/+1
| | | | | | | | | | | | | | | | | * Don't use legacy send for messages * Add migrations to ensure Matrix webhooks use PUT * Set HTTP method to PUT as default * Fix sql condition.. Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Rename getTxnID -> getMatrixTxnID * Use local variable instead of constant value Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add action feed for new release (#12324)赵智超2020-07-292-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add action feed for new release Signed-off-by: a1012112796 <1012112796@qq.com> * fix lint * Apply suggestions from code review * Add ReleaseID to the action table * Remove error message * Fold the attachments download list * remove attchment download list * simplify code * fix create release from existing tag * simplify ui * translation change * fix test Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Move jquery-minicolors to npm/webpack (#12305)silverwind2020-07-292-2/+0
| | | | | | | | | | | | | | | | | | | | * Move jquery-minicolors to npm/webpack - Unvendor and add as npm dependency - Removed unneeded backend variable - Fixed existing bug where picker would previously initizalize to the same green color when editing a label. There was probably a version bump because the previous version was over 3 years old but it seems to be compatible. * use file-loader * trailing comma and comment update * misc tweaks Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Git 2.28 no longer permits diff with ... on unrelated branches (#12364)zeripath2020-07-291-0/+2
| | | | | | | * Git 2.28 no longer permits diff with ... on unrelated branches Signed-off-by: Andrew Thornton <art27@cantab.net> * need to check stderr
* Add name filter to API for GetMilestoneList (#12336)65432020-07-283-7/+37
| | | | | | | | | Adds a name filter to the API for GetMilestoneList Includes a small refactor: merge GetMilestones and GetMilestonesByRepoID Close #12260 Needed for https://gitea.com/gitea/go-sdk/issues/383 and https://gitea.com/gitea/tea/pulls/149
* Show 404 page when release not found (#12328)赵智超2020-07-261-0/+4
| | | | | Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* models: fix xorm variable clobber (#12231)Lars Lehtonen2020-07-131-3/+1
| | | | | NewTestEngine() takes a *xorm.Engine as its argument, and then immediately overwrites it. This fixes the model package to not take an unneeded variable, and changes the routers package to not create a nil *xorm.Engine that is immediately discarded by model.
* Syntax highlight expanded code blobs (#12223)mrsdizzie2020-07-121-1/+2
| | | | | Expanded code in diffs wasn't being highlighted properly because it wasn't passing the filename to highlighting code. Fixes #12218
* Direct SVG rendering (#12157)silverwind2020-07-121-0/+3
| | | | | | | | | | | | Introduce 'make svg' which calls a node script that compiles svg files to `public/img/svg`. These files are vendored to not create a dependency on Node for the backend build. On the frontend side, configure webpack using `raw-loader` so SVGs can be imported as string. Also moved our existing SVGs to web_src/svg for consistency. Fixes: https://github.com/go-gitea/gitea/issues/11618
* Extend Notifications API and return pinned notifications by default (#12164)zeripath2020-07-123-14/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Extend notifications API and return pinned notifications in notifications list Signed-off-by: Andrew Thornton <art27@cantab.net> * fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix swagger again Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * remove spurious debugs * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/notification.go * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Default to showing closed Issues/PR list when there are only closed ↵65432020-07-091-1/+7
| | | | | issues/PRs (#12200) If all issues are closed, then set the default to show the closed issues.
* Fix regression: Gitea commits API again returns commit summaries, not full ↵Kristian Antonsen2020-07-081-1/+1
| | | | | messages (#12186) Closes #12185
* Enable cloning via Git Wire Protocol v2 over HTTP (#12170)William Hilton2020-07-081-4/+15
| | | | | | | * Enable Git Wire Protocol v2 over HTTP * use RunInDirTimeoutEnv * pass $HOME environment variable to git upload-pack
* Pause, Resume, Release&Reopen, Add and Remove Logging from command line (#11777)zeripath2020-07-053-3/+122
| | | | | | | | | | | | | | | | | | | | | | * Make LogDescriptions race safe * Add manager commands for pausing, resuming, adding and removing loggers Signed-off-by: Andrew Thornton <art27@cantab.net> * Placate lint * Ensure that file logger is run! * Add support for smtp and conn Signed-off-by: Andrew Thornton <art27@cantab.net> * Add release-and-reopen Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Multiple small admin dashboard fixes (#12153)zeripath2020-07-051-3/+6
| | | | | | | | | * Remove spurious spacing between Maintenance Operations and its table on dashboard * Prevent (EXTRA string) comments in Task headers * Redirect tasks started from monitor page back to monitor * Fix #12107 - redirects from process cancel should use AppSubUrl * When wrapping queues set the name correctly Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove spurious logging (#12139)zeripath2020-07-051-3/+0
| | | | | | | Unfortunately #10745 merged a spurious logging message. This PR removes this. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix repo API listing stability (#12057)Clark Boylan2020-07-021-0/+1
| | | | | | | | | | | | | | Repo listings are paginated in the API now. Unfortunately, they are ORDER BY updated_unix which only has second resolution. This means that if you do a listing when multiple projects were created at the same time you can unstable ordering. If that unstable ordering happens at a page boundary you may fail to get a complete repo listing. To make things worse sorting by updated_unix means that we may never get a complete listing because udpated_unix can change independent of our API calls. Fix this by making the API repo listing order by id instead.
* Provide option to unlink a fork (#11858)zeripath2020-07-021-2/+39
| | | | | | | | | | | | | | | | | | | | | | * Provide option to unlink a fork Fix #4566 Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review Co-authored-by: techknowlogick <matti@mdranta.net> * Add check that user can create repo Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @cirnoT Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
* Ensure BlameReaders close at end of request (#12102)zeripath2020-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | #11716 reports multiple git blame processes hanging around this was thought to be due to timeouts, however on closer look this appears to be due to the Close() function of the BlameReader hanging with a blocked stdout pipe. This PR fixes this Close function to: * Cancel the context of the cmd * Close the StdoutReader - ensuring that the output pipe is closed Further it makes the context of the `git blame` command a child of the request context - ensuring that even if Close() is not called, on cancellation of the Request the blame is command will also be cancelled. Fixes #11716 Closes #11727 Signed-off-by: Andrew Thornton <art27@cantab.net>