summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Add configurable Trust Models (#11712)zeripath2020-09-206-92/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add configurable Trust Models Gitea's default signature verification model differs from GitHub. GitHub uses signatures to verify that the committer is who they say they are - meaning that when GitHub makes a signed commit it must be the committer. The GitHub model prevents re-publishing of commits after revocation of a key and prevents re-signing of other people's commits to create a completely trusted repository signed by one key or a set of trusted keys. The default behaviour of Gitea in contrast is to always display the avatar and information related to a signature. This allows signatures to be decoupled from the committer. That being said, allowing arbitary users to present other peoples commits as theirs is not necessarily desired therefore we have a trust model whereby signatures from collaborators are marked trusted, signatures matching the commit line are marked untrusted and signatures that match a user in the db but not the committer line are marked unmatched. The problem with this model is that this conflicts with Github therefore we need to provide an option to allow users to choose the Github model should they wish to. Signed-off-by: Andrew Thornton <art27@cantab.net> * Adjust locale strings Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @6543 Co-authored-by: 6543 <6543@obermui.de> * Update models/gpg_key.go * Add migration for repository Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor: move Commit To APIFormat Code & Lot of StopWatch related things ↵65432020-09-181-65/+3
| | | | | | | | | | | | | (#12729) * move GitCommit to APIFormat convertion into convert package * rename Commit convert functions * move stopwatch to api convertion into convert package & rm unused code & extend test * fix compare time * Gitea not Gogs ;)
* Simplify CheckUnitUser logic (#12854)赵智超2020-09-152-10/+15
| | | | | | | | if check one user's unit in different repos, it's not necessary to get user data every time. Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add migration for password algorithm change (#12784)zeripath2020-09-152-0/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add migration for password algorithm change #12688 changed the default for the user table leading to sync2 warnings Unfortunately changing defaults requires a complete table rewrite in general. However, just dropping columns could be bad - so this PR leverages the techniques used in recreate table to recreate from the inferred schema and recreates the user table. This is not necessarily the correct thing to do - but code sometimes speaks louder than words. Signed-off-by: Andrew Thornton <art27@cantab.net> * oops Signed-off-by: Andrew Thornton <art27@cantab.net> * ok lets use the shorter bits for other dbs Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/migrations/v150.go * Update models/migrations/v150.go * fix migration Signed-off-by: Andrew Thornton <art27@cantab.net> * mv v150 to v151.go Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add postgres schema to the search_path on database connection (#12634)zeripath2020-09-111-0/+10
| | | | | | | | | | Rather than rely on the user running the gitea server and db setting the schema search_path correctly - if gitea is run with a schema we should simply set the search_path to have that schema first in the path. Fix #12505 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Whilst changing the character set to utf8mb4 we should set ↵zeripath2020-09-111-1/+5
| | | | | | | | ROW_FORMAT=dynamic too (#12804) Fix #12801 Signed-off-by: Andrew Thornton <art27@cantab.net>
* [API] Migration: Change ServiceType String (#12672)65432020-09-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * use different structs for MigrateRepoOptions on UI and API * Fix TokenAuth and rename UID to an understandable Name * fix swagger doc * simplify & mk redable * R E F A C T O R: migration has now internal 3 structs to store its options: * the Options for WebUI: modules/auth/repo_form.go * the Options for API: modules/structs/repo.go * the option struct with after validation for internal prossessing: modules/migrations/base/options.go * Copyright Header * Deprecate UID - add RepoOwner * adopt repo.go -> migrate.go * add comment about each struct purpose * lint
* Add Primary Key to Topic and RepoTopic (#12639)zeripath2020-09-103-3/+44
| | | | | | | | Add a primary key to Topic and RepoTopic tables Fix #8920 Signed-off-by: Andrew Thornton <art27@cantab.net>
* ui: change commentTag style (#11668)赵智超2020-09-101-0/+3
| | | | | | | | | | | | | | | | | | | * ui: change commentTag style * Add comment tag in first comment (issue content) * Show CommentTagPoster in other way Signed-off-by: a1012112796 <1012112796@qq.com> * Update routers/repo/issue.go Co-authored-by: Lauris BH <lauris@nix.lv> * fix lint * revert CommentTagPoster Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix "only mail on mention" bug (#12775)赵智超2020-09-092-1/+28
| | | | | | | | | | | * fix mail mention bug fix #12774 Signed-off-by: a1012112796 <1012112796@qq.com> * fix test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Change/remove a branch of an open issue (#9080)Vedran2020-09-081-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add field with isIssueWriter to front end * Make branch field editable * Switch frontend to form and POST from javascript * Add /issue/id/ref endpoint to routes * Use UpdateIssueTitle model to change ref in backend * Removed crossreference check and adding comments on branch change * Use ref returned from POST to update the field * Prevent calling loadRepo from models/ * Branch/tag refreshed without page reload * Remove filter for empty branch name * Add clear option to tag list as well * Delete button translation and coloring * Fix for not showing selected branch name in new issue * Check that branch is not being changed on a PR * Change logic * Notification when changing issue ref * Fix for renamed permission parameter * Fix for failing build * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Gitea <gitea@fake.local> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* LFS support to be stored on minio (#12518)Lunny Xiao2020-09-082-0/+33
| | | | | | | | | | | | | | | | | * LFS support to be stored on minio * Fix test * Fix lint * Fix lint * Fix check * Fix test * Update documents and add migration for LFS * Fix some bugs
* gitea dump: include version & Check InstallLock (#12760)65432020-09-072-0/+17
| | | | | | | | | * gitea dump: include version * Check InstallLock (close #12759) * fix test * fix lint
* Set setting.AppURL as GITEA_ROOT_URL environment variable during pushes (#12752)zeripath2020-09-061-0/+4
| | | | | | | * Set setting.AppURL as GITEA_ROOT_URL environment variable during pushes Fix #11738 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add command to recreate tables (#12407)zeripath2020-09-062-0/+248
| | | | | | | | | | | | | | Provides new command: `gitea doctor recreate-table` which will recreate db tables and copy the old data in to the new table. This function can be used to remove the old warning of struct defaults being out of date. Fix #8868 Fix #3265 Fix #8894 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix bug of migraition v111 (#12738)Lunny Xiao2020-09-061-3/+3
|
* Fix bug on migration 111 (#12736)Lunny Xiao2020-09-061-12/+32
| | | | | | | | | * Fix bug on migration 111 * Check reviews when migrating v111 * Fix bug * Fix commit
* implemet Cache for Stopwatches.APIFormat() (#12730)65432020-09-051-4/+31
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add Created & Updated to Milestone (#12662)65432020-09-053-1/+35
| | | | | | | | | * Add Created and Updated to Milestone table and expose via API * Expose to UI - To Overloaded ?!? * fix unit test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* additional data for type StopWatch in swagger api (#12458)Jochen Peters2020-09-051-2/+8
| | | | | | | | | | | | * additional data for type StopWatch in swagger api * fix lint-backend issue with gofmt * fix format in v1_json with 'make generate-swagger' * using issue.LoadRepo() instead of getRepositoryByID() Co-authored-by: jochen@homeland <no-go@localhost> Co-authored-by: zeripath <art27@cantab.net>
* [BugFix] Fix comment broken issue ref dependence (#12651)65432020-09-043-0/+21
| | | | | | | | | | | | | * 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>
* Use argon as default password hash algorithm (#12688)zeripath2020-09-033-31/+60
| | | | | | | | | | | | | | | | | | | | | | | | | * Restrict TLS connections to 1.2 minimum * Set Argon2 as the default KDF * Fix user.yml * Remove TLS minversion changes Signed-off-by: Andrew Thornton <art27@cantab.net> * Add migration as per @techknowlogick Signed-off-by: Andrew Thornton <art27@cantab.net> * set the password algo in the fixtures Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove the v148 migration - it needs recreate table to change the defaults Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Nadim Kobeissi <nadim@symbolic.software>
* Rename models.ProtectedBranchRepoID to models.EnvRepoID and ensure ↵zeripath2020-08-302-12/+11
| | | | | | EnvPusherEmail is set (#12646) Signed-off-by: Andrew Thornton <art27@cantab.net>
* [API] Delete Token accept names too (#12366)65432020-08-282-10/+21
| | | | | | | | * Delete Token accept names too * better description Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Open transaction when adding Avatar email-hash pairs to the DB (#12577)zeripath2020-08-241-1/+12
| | | | | | | | | | | | | | | | | | | | | When adding Avatar email-hash pairs we simply want the DB table to represent a Set. We don't care if the hash-pair is already present, so we just simply Insert and ignore the error. Unfortunately this seems to cause some DBs to log the duplicate insert to their logs - looking like a bug a in Gitea. Now, there is no standard way in SQL to say Insert but if there's an error ignore it. MySQL has INSERT IGNORE, PostgreSQL >= 9.5 has INSERT ... ON CONFLICT DO NOTHING, but I do not believe that SQLite or MSSQL have variants. This PR places the insert in a transaction which we are happy to fail if there is an error - hopefully this will stop the unnecessary logging. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* OpenGraph: use repo avatar if exist (#12586)65432020-08-241-0/+5
|
* Add cron running API (#12421)zeripath2020-08-241-0/+8
| | | | | | | | | | | | | | | | | | | * 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>
* Add email notify for new release (#12463)赵智超2020-08-231-0/+1
| | | | | | * Add email notify for new release Signed-off-by: a1012112796 <1012112796@qq.com>
* Fix bug on migration 147 (#12565)Lunny Xiao2020-08-221-38/+60
|
* Allow addition of gpg keyring with multiple keys (#12487)zeripath2020-08-212-63/+73
| | | | | | | Related #6778 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Prevent NPE on commenting on lines with invalidated comments (with ↵zeripath2020-08-212-0/+134
| | | | | | | | | | | | | | | | | | | | | | migration) (#12549) * Prevent NPE on commenting on lines with invalidated comments Only check for a review if we are replying to a previous review. Prevent the NPE in #12239 by assuming that a comment without a Review is non-pending. Fix #12239 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add hack around to show the broken comments Signed-off-by: Andrew Thornton <art27@cantab.net> * Add migration and remove template hacks Signed-off-by: Andrew Thornton <art27@cantab.net>
* Default empty merger list to those with write permissions (#12535)zeripath2020-08-201-2/+3
| | | | | Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add a storage layer for attachments (#11387)Lunny Xiao2020-08-187-47/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1619-7/+1185
| | | | | | | | | | | | | 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-163-7/+7
| | | | | | | | | | | | | | | | | * 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
* Keys should not verify revoked email addresses (#12486)zeripath2020-08-161-0/+3
| | | | | Fix #6778 Signed-off-by: Andrew Thornton <art27@cantab.net>
* UI: Update commit signature view (#12473)techknowlogick2020-08-131-1/+1
|
* Re-attempt to delete temporary upload if the file is locked by another ↵zeripath2020-08-1112-46/+49
| | | | | | | | | | | 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>
* Make dashboard newsfeed list length a configurable item (#12469)techknowlogick2020-08-111-2/+2
| | | Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Fix Migration 145 on MSSQL if varchar is changed to nvarchar (#12445)zeripath2020-08-101-0/+22
| | | | | | | | | | | | | | | | | | | | | | | * Handle MSSQL constraints Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/migrations/v145.go * Prevent hang with Sync2 * Agh it's uniques not indexes * Let us try a different way of finding constraints on the language column Signed-off-by: Andrew Thornton <art27@cantab.net> * minor simplification Signed-off-by: Andrew Thornton <art27@cantab.net> * Try drop index instead? Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use transaction in V102 migration (#12395)zeripath2020-08-062-5/+7
| | | | | | | The code for dropTableColumns has a slightly confusing portion whereby the session is committed for MSSQL but not for other variants. The v102 migration doesn't actually start a transaction so this weirdness does not affect it. However it probably should attempt to run this in a transaction. Signed-off-by: Andrew Thornton art27@cantab.net
* Need RepoID in the languagestat field (#12427)zeripath2020-08-041-0/+1
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Increase size of the language column in language_stat (#12396)zeripath2020-08-043-2/+62
| | | | | | | | | In #12379 it was discovered that enry v2 has a maximum language length of 34 characters which is larger than the 30 previously provided. This PR updates the language column to 50. Fix #12379
* models: break out of loop (#12386)Lars Lehtonen2020-07-311-1/+2
|
* Don't use legacy method to send Matrix Webhook (#12348)S7evinK2020-07-302-0/+27
| | | | | | | | | | | | | | | | | * 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-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add name filter to API for GetMilestoneList (#12336)65432020-07-282-27/+52
| | | | | | | | | 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
* Refactor: Remove Dependencies from Migration v111 (#11646)65432020-07-261-15/+344
| | | | | | | * Refactor: Remove Dependencys from Migration v111 * Update models/migrations/v111.go Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix ipv6 parsing (#12321)Wim2020-07-261-3/+13
| | | | | | | | | | | | * Fix ipv6 parsing * Update modules/setting/setting.go Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Migrations (v82,v96,v99,v136) remove dependencies (#12286)65432020-07-224-11/+35
| | | | | | | * remove dependencys * add missing fields * CI.restart()