summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Prevent empty div when editing comment (#12404) (#12991)techknowlogick2020-10-011-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 Co-authored-by: zeripath <art27@cantab.net>
* Mirror: Update DB on Address-Update too (#12964) (#12967)65432020-09-281-2/+2
| | | | | | | | | * Mirror: Update DB on Address-Update too (#12964) * Mirror: Update DB on Address-Update too * new name for function to better describe * fix lint
* Fix ListUserOrgs (#12910) (#12915)赵智超2020-09-211-1/+1
| | | | | | | | | fix #12891 Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix [API] CreateRepo missing information (#12848) (#12867)65432020-09-181-0/+6
| | | | | | | | | | | | | | | | * Fix [API] [Bug] CreateRepo missing information (#12848) * Fix [API] [Bug] CreateRepo missing information * add code comment Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> * CI.restart() * CI.restart() Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Support slashes in release tags (#12864) (#12882)zeripath2020-09-172-3/+3
| | | | | | | Backport #12864 Fix #12861 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Escape more things that are passed through str2html (#12622) (#12850)zeripath2020-09-151-2/+3
| | | | | | | | | | | | | Backport #12622 * 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
* Fix notifications page links (#12838) (#12853)zeripath2020-09-151-0/+1
| | | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* [Backport] Fix comment broken issue ref dependence (#12651) (#12692)65432020-09-031-2/+4
| | | | | | | * deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too * Ignore ErrIssueNotExist on comment.LoadDepIssueDetails() * CI.restart()
* Fix bug preventing transfer to private organization (#12497) (#12501)techknowlogick2020-08-172-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 Co-authored-by: zeripath <art27@cantab.net>
* Fix ignored login on compare (#12476) (#12478)techknowlogick2020-08-121-1/+1
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Git 2.28 no longer permits diff with ... on unrelated branches (#12370)zeripath2020-07-291-0/+2
| | | | | Backport #12364 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Show 404 page when release not found (#12328) (#12332)techknowlogick2020-07-271-0/+4
| | | | | | | | Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 赵智超 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Extend Notifications API and return pinned notifications by default (#12164) ↵zeripath2020-07-133-14/+125
| | | | | | | | | | | | | (#12232) Backport #12164 This PR extends the notifications API to allow specific notification statuses to be searched for and to allow setting of notifications to statuses other than read. By default unread and pinned statuses will be returned when querying for notifications - however pinned statuses will not be marked as read. Close #12152 Signed-off-by: Andrew Thornton art27@cantab.net
* Fix regression: Gitea commits API again returns commit summaries, not full ↵techknowlogick2020-07-081-1/+1
| | | | | | | messages (#12186) (#12187) Closes #12185 Co-authored-by: Kristian Antonsen <kristian@derfor.dk>
* Multiple small admin dashboard fixes (#12153) (#12156)zeripath2020-07-051-3/+6
| | | | | | | | * 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) (#12148)zeripath2020-07-051-3/+0
| | | | | | | | | | | | Backport #12139 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> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Ensure BlameReaders close at end of request (#12102) (#12103)zeripath2020-07-011-1/+7
| | | | | | | | | | | | | | | | | | | | | Backport #12102 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>
* Global default branch setting (#11918) (#11937)techknowlogick2020-06-171-0/+1
| | | | | | | | | | | | | | | * Global default branch setting (#11918) * Global default branch setting * add to app.ini example per @silverwind * update per @lunny Co-authored-by: John Olheiser <john.olheiser@gmail.com> * Update modules/setting/repository.go Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Rework api/user/repos for pagination (#11827) (#11877)Cirno the Strongest2020-06-131-21/+33
| | | | | | | | | | | | | | | * Add count to `GetUserRepositories` so that pagination can be supported for `/user/{username}/repos` * Rework ListMyRepos to use models.SearchRepository ListMyRepos was an odd one. It first fetched all user repositories and then tried to supplement them with accessible map. The end result was that: * Limit for pagination did not work because accessible repos would always be appended * The amount of pages was incorrect if one were to calculate it * When paginating, all accessible repos would be shown on every page Hopefully it should now work properly. Fixes #11800 and does not require any change on Drone-side as it can properly interpret and act on Link header which we now set. Co-authored-by: Lauris BH <lauris@nix.lv> (cherry picked from commit 0159851cc3fa80e4df4908a5e760afa20452f712)
* Handle more pathological branch and tag names (#11843) (#11863)zeripath2020-06-123-10/+24
| | | | | | | | | | | | | | | | Backport #11843 It's possible to push quite pathological appearing branch names to gitea using git push gitea reasonable-branch:refs/heads/-- at which point large parts of the UI will break. Similarly you can git push origin reasonable-tag:refs/tags/-- which wil return an error. This PR fixes the problems these cause. It also changes the code from creating branches to pushing to ensure that branch restoration has to pass hooks. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Honor DEFAULT_PAGING_NUM for API (#11805) (#11813)Cirno the Strongest2020-06-092-13/+0
| | | | | | | | | | | * Honor DEFAULT_PAGING_NUM for API * set pagination to 10 for tests * lint Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit cefbf73aea912c510a8dd194532233076b822d37)
* Ensure rejected push to refs/pull/index/head fails nicely (#11724) (#11809)zeripath2020-06-081-5/+27
| | | | | | | | | | | Backport #11724 A pre-receive hook that rejects pushes to refs/pull/index/head will cause a broken PR which causes an internal server error whenever it is viewed. This PR handles prevents the internal server error by handling non-existent pr heads and sends a flash error informing the creator there was a problem. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add option to API to update PullRequest base branch (#11666) (#11796)65432020-06-071-0/+26
| | | | | | | * EditPull: add option to change base Close #11552 Co-authored-by: Lauris BH <lauris@nix.lv>
* In File Create/Update API return 404 if Branch does not exist (#11791) (#11795)65432020-06-071-0/+4
| | | | | * In File Create/Update API return 404 if Branch does not exist (#11791) * v1.12 version ;)
* Fix doer of rename repo (#11789) (#11794)赵智超2020-06-071-1/+1
| | | | | | | | | fix #11725 Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Fix timezone on issue deadline (#11697) (#11784)Cirno the Strongest2020-06-061-1/+1
| | | | | | | | * Fix timezone on issue deadline * FormatDate Co-authored-by: zeripath <art27@cantab.net> (cherry picked from commit bbe13b60cdf93d8296f4c6dab624df2b571db234)
* Handle expected errors in FileCreate & FileUpdate API (#11643) (#11718)65432020-06-011-2/+37
| | | | | as title needed for #11641
* Fix missing authorization check on pull for public repos of private/limited ↵Cirno the Strongest2020-05-291-0/+11
| | | | | | | org (#11656) (#11682) Fixes #11651 (cherry picked from commit 02fa329a7c2190d947cd5e02ea90d2d4406653be)
* Handle expected errors in AddGPGkey API (#11644) (#11661)65432020-05-281-2/+10
| | | | | | | | | * handle GPG Parse & Email Errors * correct TEST * update Swagger * more Docu
* When must change password only show Signout (#11600) (#11637)guillep2k2020-05-271-0/+1
| | | | | | | | | | | | | | When "Must Change Password" simplify the navbar header to only show the signout button as all other links will redirect back. This prevents the notifications icon from showing preventing initialization of the event-source and hence preventing redirect_to being set, however in addition do not set the redirect_to cookie if we are looking at the /user/events page. Fix #11554 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Allow different HardBreaks settings for documents and comments (#11515) (#11599)zeripath2020-05-244-7/+17
| | | | | | | | | | | | | | | GH has different HardBreaks behaviour for markdown comments and documents. Comments have hard breaks and documents have soft breaks - therefore Gitea's rendering will always be different from GH's if we only provide one setting. Here we split the setting in to two - one for documents and one for comments and other things. Signed-off-by: Andrew Thornton art27@cantab.net Changes to index.js as per @silverwind Co-authored-by: silverwind <me@silverwind.io> Changes to docs as per @guillep2k Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Prevent transferring repos to invisible orgs (#11517) (#11549)guillep2k2020-05-221-0/+9
| | | | | | Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com> Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net>
* Move serviceworker to workbox and fix SSE interference (#11538) (#11547)silverwind2020-05-221-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move serviceworker to workbox and fix SSE interference Instead of statically hardcoding every frontend asset, this uses a type-based approach to cache all js,css and manifest.json requests. This also fixes the issue that the service worker was interfering with EventSource because it was unconditionally handling all requests which this new implementation doesn't. Fixes: https://github.com/go-gitea/gitea/issues/11092 Fixes: https://github.com/go-gitea/gitea/issues/7372 * rethrow error instead of logging * await .register * Revert "rethrow error instead of logging" This reverts commit 043162ba1f18b98a4bf9635959fd28d16e839fc5. * improve comment * remove JSRenderer * add version-based cache invalidation * refactor * more refactor * remove comment * rename item to fit cache name Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Fix repo-list private and total count bugs (#11500) (#11532)zeripath2020-05-211-3/+6
| | | | | | | | | | | | | | | | | | | | | * Fix repo-list private and total count bugs Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure limited and private org public repos are displayed on "private" Signed-off-by: Andrew Thornton <art27@cantab.net> * switch from onlyPrivate to is_private Signed-off-by: Andrew Thornton <art27@cantab.net> * Generate swagger Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Ensure public repositories in private organizations are visible and fix ↵65432020-05-181-1/+2
| | | | | | | | | | | | | | | | | | | | admin organizations list (#11465) (#11474) * Ensure that we can see public repositories in private organization Fix #10144 (Again) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix Admin users and organizations page Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/repo_list.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Whenever the ctx.Session is updated, release it to save it before sending ↵zeripath2020-05-176-100/+168
| | | | | | | the redirect (#11456) Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Forcibly clean and destroy the session on logout (#11447)zeripath2020-05-171-5/+2
| | | | | Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Refactor Cron and merge dashboard tasks (#10745)zeripath2020-05-162-59/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Cron and merge dashboard tasks * Merge Cron and Dashboard tasks * Make every cron task report a system notice on completion * Refactor the creation of these tasks * Ensure that execution counts of tasks is correct * Allow cron tasks to be started from the cron page * golangci-lint fixes * Enforce that only one task with the same name can be registered Signed-off-by: Andrew Thornton <art27@cantab.net> * fix name check Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k * as per @lafriks Signed-off-by: Andrew Thornton <art27@cantab.net> * Add git.CommandContext variants Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Make API EditIssue and EditPullRequest issue notifications (#11123)zeripath2020-05-172-21/+36
| | | | | | | | | | | | | | | | | | | | | | | * Make API EditIssue and EditPullRequest issue notifications Restructure models.UpdateIssueByAPI and EditIssue/EditPullRequest to issue notifications Fix #10014 Signed-off-by: Andrew Thornton <art27@cantab.net> * As per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * update status! Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add paging and archive/private repository filtering to dashboard list (#11321)zeripath2020-05-161-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add archived options to SearchRepository Signed-off-by: Andrew Thornton <art27@cantab.net> * Add only-private search Signed-off-by: Andrew Thornton <art27@cantab.net> * Add filter options and paging to dashboard repository page Signed-off-by: Andrew Thornton <art27@cantab.net> * swagger generate Signed-off-by: Andrew Thornton <art27@cantab.net> * fix-swagger-again Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @mrsdizzie also remember state Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Support view individual commit for wiki pages (#11415)mrsdizzie2020-05-163-5/+34
| | | | | | | | Currently you can see a list of commit history for wiki pages but aren't able to view the commit diff itself. This adds the feature to view an individual commit to a wiki repo. Closes #8999 Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Check that the ctx.User is not nil before checking its ID (#11424)zeripath2020-05-151-1/+1
| | | | | | | Fix #11423 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix webhook template when validation errors occur (#11421)kolaente2020-05-151-2/+9
| | | Signed-off-by: kolaente <k@knt.li>
* Fix ref links in issue overviews for tags (#8742)Sijmen Schoon2020-05-142-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Properly generate ref URLs Tags used to not generate correct URLs (src/branch/tags/1.0.0 instead of src/tags/1.0.0). Also cleans up some code around it with the created helper functions. * Fix formatting and create migration * Add copyright head to utils_test * Use a raw query for the ref migration * Remove semicolon * Quote column and table names in migration SQL * Change || to CONCAT, since MSSQL does not support || * Make migration engine aware * Add missing import * Move ref EndName and URL to the issue service * Fix tests * Add test for commit refs * Update issue.go * Use the right command for building JavaScript bundles * Prepare for merge * Check for refs/* before prepending in migration * Update services/issue/issue_test.go * Update modules/git/utils_test.go Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <matti@mdranta.net>
* Switch code editor to Monaco (#11366)silverwind2020-05-141-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Switch code editor to Monaco This switches out CodeMirror for Monaco which is based on the same code base as VS code and should work pretty similar to it. It does add a few async chunks, totalling around 10MB to our build. It currently supports around 65 languages and in the default configuration, each language would emit one ugly [number].js chunk, so I opted to combine them all into a single file for now. CodeMirror is still being used under the hood by SimpleMDE so it can not be removed yet. * inline editorconfig, fix diff, use for markdown, remove more dead code * refactors, remove jquery usage * use tab_width * fix intellisense * rename function for clarity * misc tweaks, enable webpack progress display * only use --progress on dev build * remove useless borders in arc-green * fix typo * remove obsolete comment * small refactor * fix file creation and various refactors * unset useTabStops too when no editorconfig * small refactor * disable webpack's [big] warnings * remove useless await * fix dark theme check * rename chunk to 'monaco' * add to .gitignore and delete webpack dest before build * increase editor height * support more editorconfig properties * remove empty element filter * rename Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Refactor Milestone related (#11225)65432020-05-123-12/+15
|
* ui: Replenish the missing ‘PageIsSignUp’ in sign up view (#11390)赵智超2020-05-121-0/+2
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* Allow compare page to look up base, head, own-fork, forkbase-of-head (#11327)zeripath2020-05-121-40/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow compare page to look up base, head, own-fork, forkbase-of-head Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Update routers/repo/compare.go * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix 500 with fork of fork Signed-off-by: Andrew Thornton <art27@cantab.net> * Prevent 500 on compare different trees Signed-off-by: Andrew Thornton <art27@cantab.net> * dotdotdot is perfectly valid in both usernames and repo names Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * only set headRepo == baseRepo if isSameRepo Signed-off-by: Andrew Thornton <art27@cantab.net>
* Correctly set the organization num repos (#11339)zeripath2020-05-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Correctly set the organization num repos Correctly set the organization num repos to the number of accessible repos for the user Fix #11194 Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * attempt to fix mssql Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/user.go * Explicit columns Signed-off-by: Andrew Thornton <art27@cantab.net> * Add test and fix 0 counted orgs Signed-off-by: Andrew Thornton <art27@cantab.net> * remove orgname from api Signed-off-by: Andrew Thornton <art27@cantab.net>
* Consolidate API for getting single commit (#11368)Cirno the Strongest2020-05-112-49/+7
| | | | | | | | | * Allow Git ref for /repos/{owner}/{repo}/git/commits/{sha} * Consolidate API for getting single commit * Fix tests and do it differently Co-authored-by: zeripath <art27@cantab.net>