summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Update heatmap fixtures to restore tests (#8615)zeripath2019-10-212-3/+3
| | | | | * Update heatmap fixtures to restore tests * Add hint to check the fixture age on fail
* Allow Protected Branches to Whitelist Deploy Keys (#8483)zeripath2019-10-214-0/+23
| | | | | | | | | | | | | | | Add an option to protected branches to add writing deploy keys to the whitelist for pushing. Please note this is technically a breaking change: previously if the owner of a repository was on the whitelist then any writing deploy key was effectively on the whitelist. This option will now need to be set if that is desired. Closes #8472 Details: * Allow Protected Branches to Whitelist Deploy Keys * Add migration * Ensure that IsDeployKey is set to false on the http pushes * add not null default false
* Ensure default gpg settings not nil and found commits have reference to repo ↵zeripath2019-10-201-0/+2
| | | | | | | | | | (#8604) * Ensure defaultGPGSettings not nil * Ensure that coerced commits gain a reference to the repo * Add warning if trying to get defaultgpgsetting on an unattached commit
* webhook: set Content-Type for application/x-www-form-urlencoded (#8599)Viktor Szakats2019-10-201-0/+2
| | | | | This header is missing since switching http client from GiteaServer (`code.gitea.io/gitea/modules/httplib`) to Go-http-client/1.1 (`net.http`). The header [was added by default](https://github.com/go-gitea/gitea/blob/release/v1.8/modules/httplib/httplib.go#L301) by the former, but this is no longer true with `net.http`, so it needs to be done explicitly: Ref: https://github.com/go-gitea/gitea/issues/7700
* Move issue label operations to issue service package (#8553)Lunny Xiao2019-10-192-135/+0
| | | | | | | | * Move issue label operations to issue service package * fix test * fix fmt
* Improve webhooks (#8583)John Olheiser2019-10-183-93/+152
| | | | | | | | | | | | | | * Improve webhooks Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update MSTeams and ReviewPayload comment Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add repo.FullName to comments Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix bug on pull requests when transfer head repository (#8564)Lunny Xiao2019-10-186-35/+49
| | | | | | | | * fix bug on pull requests when transfer head repository * add migration and fix lint * fix tests and add a cache check on LoadBaseRepo
* Fix review webhooks (#8570)John Olheiser2019-10-181-1/+11
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Allow more than 255 characters for tokens in external_login_user table (#8554)Wenxuan Zhao2019-10-183-3/+24
| | | Signed-off-by: Wenxuan Zhao <viz@linux.com>
* Upgrade xorm to v0.8.0 (#8536)Lunny Xiao2019-10-17114-114/+114
|
* Allow externalID to be UUID (#8551)Wenxuan Zhao2019-10-174-4/+4
| | | Signed-off-by: Wenxuan Zhao <viz@linux.com>
* Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631)zeripath2019-10-164-76/+667
| | | | | | | | | | | | | | | | | | | This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
* Move sync mirror actions to mirror service package (#8518)Lunny Xiao2019-10-161-74/+0
| | | | | | | | | | * move sync mirror actions to mirror service * fix go.mod * fix lint * fix lint
* Fix migrate mirror 500 bug (#8526)Lunny Xiao2019-10-161-0/+1
|
* Restore Graceful Restarting & Socket Activation (#7274)zeripath2019-10-151-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prevent deadlock in indexer initialisation during graceful restart * Move from gracehttp to our own service to add graceful ssh * Add timeout for start of indexers and make hammer time configurable * Fix issue with re-initialization in indexer during tests * move the code to detect use of closed to graceful * Handle logs gracefully - add a pid suffix just before restart * Move to using a cond and a holder for indexers * use time.Since * Add some comments and attribution * update modules.txt * Use zero to disable timeout * Move RestartProcess to its own file * Add cleanup routine
* Enable Uploading/Removing Attachments When Editing an Issue/Comment (#8426)blueworrybear2019-10-152-0/+41
|
* Move clearlabels from models to issue service (#8326)Lunny Xiao2019-10-151-34/+0
| | | | | | | | | | * move clearlabels from models to issue service * improve code * Apply suggestions from code review Co-Authored-By: zeripath <art27@cantab.net>
* Move AddTestPullRequestTask to pull service package from models (#8324)Lunny Xiao2019-10-151-87/+0
| | | | | | * move AddTestPullRequestTask to pull service package from models * fix fmt
* Recalculate repository access only for specific user (#8481)David Svantesson2019-10-153-8/+64
| | | | | | | | | | * Recalculate repository access only for specific user Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Handle user repositories as well, and only add access if minimum mode * Need to get repo owner to check if organization
* Add pagination to commit graph page (#8360)jaqra2019-10-142-2/+3
| | | Fixes #8308
* fix bug on FindExternalUsersByProvider (#8504)Lunny Xiao2019-10-141-1/+1
|
* Update migrated repositories' issues/comments/prs poster id if user has a ↵Lunny Xiao2019-10-147-29/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | github external user saved (#7751) * update migrated issues/comments when login as github * add get userid when migrating or login with github oauth2 * fix lint * add migrations for repository service type * fix build * remove unnecessary dependencies on migrations * add cron task to update migrations poster ids and fix posterid when migrating * fix lint * fix lint * improve code * fix lint * improve code * replace releases publish id to actual author id * fix import * fix bug * fix lint * fix rawdata definition * fix some bugs * fix error message
* Rewrite reference processing code in preparation for opening/closing from ↵guillep2k2019-10-134-269/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | comment references (#8261) * Add a markdown stripper for mentions and xrefs * Improve comments * Small code simplification * Move reference code to modules/references * Fix typo * Make MarkdownStripper return [][]byte * Implement preliminary keywords parsing * Add FIXME comment * Fix comment * make fmt * Fix permissions check * Fix text assumptions * Fix imports * Fix lint, fmt * Fix unused import * Add missing export comment * Bypass revive on implemented interface * Move mdstripper into its own package * Support alphanumeric patterns * Refactor FindAllMentions * Move mentions test to references * Parse mentions from reference package * Refactor code to implement renderizable references * Fix typo * Move patterns and tests to the references package * Fix nil reference * Preliminary rendering attempt of closing keywords * Normalize names, comments, general tidy-up * Add CSS style for action keywords * Fix permission for admin and owner * Fix golangci-lint * Fix golangci-lint
* Fixes #8369: Create .ssh dir as necessary (#8486)zeripath2019-10-131-0/+24
| | | | | | | | | | * Ensure .ssh dir exists before rewriting public keys * Ensure .ssh dir exists before appending to authorized_keys * Log the error because it would be useful to know where it is trying to MkdirAll * Only try to create RootPath if it's not empty
* Move migrating repository from frontend to backend (#6200)Lunny Xiao2019-10-136-33/+370
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move migrating to backend * add loading image when migrating and fix tests * fix format * fix lint * add redis task queue support and improve docs * add redis vendor * fix vet * add database migrations and fix app.ini sample * add comments for task section on app.ini.sample * Update models/migrations/v84.go Co-Authored-By: lunny <xiaolunwen@gmail.com> * Update models/repo.go Co-Authored-By: lunny <xiaolunwen@gmail.com> * move migrating to backend * add loading image when migrating and fix tests * fix fmt * add redis task queue support and improve docs * fix fixtures * fix fixtures * fix duplicate function on index.js * fix tests * rename repository statuses * check if repository is being create when SSH request * fix lint * fix template * some improvements * fix template * unified migrate options * fix lint * fix loading page * refactor * When gitea restart, don't restart the running tasks because we may have servel gitea instances, that may break the migration * fix js * Update models/repo.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * fix tests * rename ErrTaskIsNotExist to ErrTaskDoesNotExist * delete release after add one on tests to make it run happy * fix tests * fix tests * improve codes * fix lint * fix lint * fix migrations
* Add check for empty set when dropping indexes during migration (#8471)guillep2k2019-10-121-3/+5
| | | * Add check for empty set when dropping indexes during migration
* Restore functionality for early gits (#7775)zeripath2019-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * Change tests to make it possible to run TestGit with 1.7.2 * Make merge run on 1.7.2 * Fix tracking and staging branch name problem * Ensure that git 1.7.2 works on tests * ensure that there is no chance for conflicts * Fix-up missing merge issues * Final rm * Ensure LFS filters run on the tests * Do not sign commits from temp repo * Restore tracking fetch change * Apply suggestions from code review * Update modules/repofiles/temp_repo.go
* Move change issue title from models to issue service package (#8456)Lunny Xiao2019-10-113-59/+17
| | | | | | | | * move change issue title from models to issue service package * make the change less * fix typo
* Ensure that LFS files are relative to the LFS content path (#8455)zeripath2019-10-101-2/+1
|
* Ignore mentions for users with no access (#8395)guillep2k2019-10-103-34/+155
| | | | | | | | | | | | | | | | | | | | | | * Draft for ResolveMentionsByVisibility() * Correct typo * Resolve teams instead of orgs for mentions * Create test for ResolveMentionsByVisibility * Fix check for individual users and doer * Test and fix team mentions * Run all mentions through visibility filter * Fix error check * Simplify code, fix doer included in teams * Simplify team id list build
* Fix migration v96 to keep issue attachments (#8435)guillep2k2019-10-091-1/+1
| | | | | | * Fix migration v96 to keep issue attachments * Fix == operator
* Allow users with explicit read access to give approvals (#8382)guillep2k2019-10-082-1/+35
|
* Revert "Fix issues/pr list broken when there are many repositories (#8409)" ↵Lunny Xiao2019-10-084-62/+86
| | | | | (#8427) This reverts commit 78438d310be42f9c5e0e2937ee54e6050cc8f381.
* Fix issues/pr list broken when there are many repositories (#8409)Lunny Xiao2019-10-084-86/+62
| | | | | | | | | | | | | | * fix issues/pr list broken when there are many repositories * remove unused codes * fix counting error on issues/prs * keep the old logic * fix panic * fix tests
* Update milestone issues numbers when save milestone and other code ↵Lunny Xiao2019-10-081-29/+38
| | | | | | | | | | improvements (#8411) * update milestone issues numbers when save milestone and other code improvements * fix tests * extract duplicate codes as a new function
* Fix milestone num_issues (#8221)Lunny Xiao2019-10-063-41/+44
| | | | | | | | | | | | | | | | * fix milestone num_issues * update missing completeness * only update milestone closed number when closed issue is assigned a new milestone or clear milestone * fix tests * fix update milestone num * fix completeness calculate * make completeness calucation more clear
* Add extra user information when migrating release (#8331)Lunny Xiao2019-10-053-0/+21
| | | | | | | | * add extra user information when migrating release * add migrations * fix tests
* Fix column name ambiguity in GetUserIssueStats() (#8347)guillep2k2019-10-032-4/+17
| | | | | | | | * Add test for FilterModeMention * Fix column name ambiguity * Fix fmt
* Transaction-aware retry create issue to cope with duplicate keys (#8307)guillep2k2019-10-033-18/+57
| | | | | | | | | | | | | | * Revert #7898 * Transaction-aware retry create issue to cope with duplicate keys * Restore INSERT ... WHERE usage * Rearrange code for clarity * Fix error return in newIssue() * Fix error message
* Api: advanced settings for repository (external wiki, issue tracker etc.) ↵David Svantesson2019-10-021-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (#7756) * Add API for Repo Advanced Settings of wiki and issue tracker Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add some integration tests for tracker and wiki settings through API * Should return StatusUnprocessableEntity in case of invalid API values. * Add tests for invalid URLs for external tracker and wiki. * Do not set inital values if they are default of type * Make issue tracker and wiki units separate structures in Repository API structure. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix comment of structures Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Rewrite API to use struct for setting tracker and wiki settings. * LetOnlyContributorsTrackTime -> AllowOnlyContributorsToTrackTime
* Move mirror to a standalone package from models (#7486)Lunny Xiao2019-10-012-390/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move mirror to a standalone package * fix mirror address in template * fix tests * fix lint * fix comment * fix tests * fix tests * fix vendor * fix fmt * fix lint * remove wrong file submitted * fix conflict * remove unrelated changes * fix go mod * fix tests * clean go mod * make vendor work * make vendor work * fix tests * remove duplicated test
* API endpoint for searching teams. (#8108)David Svantesson2019-10-011-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Api endpoint for searching teams. Signed-off-by: dasv <david.svantesson@qrtech.se> * Move API to /orgs/:org/teams/search Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Regenerate swagger Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix search is Get Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add test for search team API. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Update routers/api/v1/org/team.go grammar Co-Authored-By: Richard Mahn <richmahn@users.noreply.github.com> * Fix review comments Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix some issues in repo collaboration team search, after changes in this PR. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Remove teamUser which is not used and replace with actual user id. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Remove unused search variable UserIsAdmin. * Add paging to team search. * Re-genereate swagger Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix review comments Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * fix * Regenerate swagger
* Extract actions on deletereleasebyid from models to release service (#8219)Lunny Xiao2019-10-012-67/+10
| | | | | | * extract actions on deletereleasebyid from models to release service * fix tests
* Extract actions on new issue from models to services (#8217)Lunny Xiao2019-09-301-25/+0
| | | | | | | | * extract actions on new issue from models to services * improve code * rename services/issues to services/issue
* Show correct commit status in PR list (#8316)Elias Norberg2019-09-301-3/+6
| | | | | | | | | | * Use correct index when fetching commit status Signed-off-by: Elias Norberg <elias@aisle.se> * Compare against base repo to avoid mismatch when merging from fork Signed-off-by: Elias Norberg <elias@aisle.se>
* Upgrade xorm to latest to fix insert issue bug (#8309)Lunny Xiao2019-09-291-0/+33
| | | | | | | | | | * upgrade xorm to latest to fix insert issue bug * add newissue unit tests * update xorm version * fix tests
* Extract actions on new pull request from models to pulls service and move ↵Lunny Xiao2019-09-271-27/+0
| | | | | | | | | | | | | | code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull (#8218) * extract actions on new pull request from models to pulls service * improve code * move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull * fix fmt * Rename pulls.go to pull.go
* Alwaywas return local url for users avatar (#8245)Sandro Santilli2019-09-262-3/+15
| | | | | | | | | | | * Always return local url for users avatar Avoids having to wait for DNS lookups when libravatar is activated fixing #6046 * Avoid double slash in avatar link * Move avatar route to the correct place
* Fix nil ref (#8281)guillep2k2019-09-251-1/+1
|
* Move create issue comment to comments package (#8212)Lunny Xiao2019-09-241-111/+6
| | | | | | | | | | * move create issue comment to comments package * extract actions on update/delete comment from models to comment service * fix lint * fix lint