summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Add DefaultMergeStyle option to repository (#14789)parnic2021-03-272-1/+11
| | | Fixes #12293
* Create Proper Migration Tests (#15116)zeripath2021-03-2416-12/+1007
| | | | | | | | | | | | | | * Create Proper Migration tests Unfortunately our testing regime has so far meant that migrations do not get proper testing. This PR begins the process of creating migration tests for this. * Add test for v176 * fix mssql drop db Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix Migration 176 yet again (#15131)zeripath2021-03-233-9/+10
| | | | | | | | | | | | | | * Fix Migration 176 yet again Whilst creating a test for v176 in the migrations_test PR it has become clear that this was still wrong. This is now fixed. Genuinely. Signed-off-by: Andrew Thornton <art27@cantab.net> * and fix repo transfer Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix consistency check (#15120)zeripath2021-03-231-1/+1
| | | | | | In my last fix I missed adding the label_ prefix to the consistency check count. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix the v176 migration (#15110)zeripath2021-03-223-3/+3
| | | | | | | | There is a serious issue with the v176 migration where there is a mistaken missing label_id selection. *introduced by #14912* Signed-off-by: Andrew Thornton <art27@cantab.net>
* Implement delete release attachments and update release attachments' name ↵Lunny Xiao2021-03-233-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | (#14130) * Implement delete release attachment * Add attachments on release edit page * Fix bug * Finish del release attachments * Fix frontend lint * Fix tests * Support edit release attachments * Added tests * Remove the unnecessary parameter isCreate from UpdateReleaseOrCreatReleaseFromTag * Rename UpdateReleaseOrCreatReleaseFromTag to UpdateRelease * Fix middle align
* Delete Labels & IssueLabels on Repo Delete too (#15039)65432021-03-196-8/+98
| | | | | | | | | | | | | | | | | | | | | | | * Doctor: find IssueLabels without existing label * on Repo Delete: delete labels & issue_labels too * performance nits * Add Migration: Delete orphaned IssueLabels * Migration v174: use Sync2 * USE sess !!! * better func name * code format & comment * RAW SQL * Update models/migrations/v176.go * next try?
* Prevent addition of labels from outside the repository or organisation in ↵zeripath2021-03-193-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues (#14912) * Never add labels not from this repository or organisation and remove org labels on transfer Prevent the addition of labels from outside of the repository or organisation and remove organisation labels on transfer. Related #14908 Signed-off-by: Andrew Thornton <art27@cantab.net> * switch to use sql Signed-off-by: Andrew Thornton <art27@cantab.net> * remove AS Signed-off-by: Andrew Thornton <art27@cantab.net> * subquery alias Signed-off-by: Andrew Thornton <art27@cantab.net> * Give me some AS? Signed-off-by: Andrew Thornton <art27@cantab.net> * double AS Signed-off-by: Andrew Thornton <art27@cantab.net> * try try again Signed-off-by: Andrew Thornton <art27@cantab.net> * once more around the merry go round Signed-off-by: Andrew Thornton <art27@cantab.net> * fix api problem Signed-off-by: Andrew Thornton <art27@cantab.net> * Add outside label consistency check into doctor This PR adds another consistency check into doctor in order to detect labels that have been added from outside of repositories and organisations Fix #14908 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix migration Signed-off-by: Andrew Thornton <art27@cantab.net> * prep for merge Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix postgres ID sequences broken by recreate-table (#15015)zeripath2021-03-183-1/+178
| | | | | | | | | | | | | | | | | | | | | * Fix postgres ID sequences broken by recreate-table Unfortunately there is a subtle problem with recreatetable on postgres which leads to the sequences not being renamed and not being left at 0. Fix #14725 Signed-off-by: Andrew Thornton <art27@cantab.net> * let us try information_schema instead Signed-off-by: Andrew Thornton <art27@cantab.net> * try again Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de>
* sort release attachments by name (#15008)Norwin2021-03-171-1/+1
| | | | | Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Ensure validation occurs on clone addresses too (#14994)zeripath2021-03-152-28/+28
| | | | | | | | | | | | | | | | | | | | | * Ensure validation occurs on clone addresses too Fix #14984 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix api tests Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* chore(models): rewrite code format. (#14754)Bo-Yi Wu2021-03-14103-460/+474
| | | | | | | | | | | | | | | * chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
* API: fix set milestone on PR creation (#14981)Norwin2021-03-133-1/+18
| | | | | | | | | | | | | | * API: fix set milestone on PR creation pr creation via API failed with 404, because we searched for milestoneID 0, due to uninitialized var usage D: * add tests * fix expected status codes * fix tests Co-authored-by: 6543 <6543@obermui.de>
* Never add labels not from this repository or organisation and remove org ↵zeripath2021-03-123-5/+61
| | | | | | | | | | | | | | | | | | labels on transfer (#14928) * Never add labels not from this repository or organisation and remove org labels on transfer Prevent the addition of labels from outside of the repository or organisation and remove organisation labels on transfer. Related #14908 * switch to use sql * subquery alias * once more around the merry go round * fix api problem
* Add "captcha" to list of reserved usernames (#14929)fnetX (aka fralix)2021-03-081-0/+1
| | | Signed-off-by: Otto Richter <git@fralix.ovh>
* Fix overdue marking of closed issues and milestones (#14923)zeripath2021-03-082-2/+7
| | | | | | | | Closed milestones and issues should only be marked overdue if they were closed after their deadline. Fix: #14536 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix issue search with db indexer because of mysql 5.7 sqlmode (#14907)Lunny Xiao2021-03-061-1/+10
| | | | | * Fix sqlmode bug * distinct is necessary
* When transfering repository and database transaction failed, rollback the ↵Lunny Xiao2021-03-051-1/+37
| | | | | | | | renames (#14864) Fix #14821 Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Make manual merge autodetection optional and add manual merge as merge ↵a10121127962021-03-032-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | method (#12543) * Make auto check manual merge as a chooseable mod and add manual merge way on ui as title, Before this pr, we use same way with GH to check manually merge. It good, but in some special cases, misjudgments can occur. and it's hard to fix this bug. So I add option to allow repo manager block "auto check manual merge" function, Then it will have same style like gitlab(allow empty pr). and to compensate for not being able to detect THE PR merge automatically, I added a manual approach. Signed-off-by: a1012112796 <1012112796@qq.com> * make swager * api support * ping ci * fix TestPullCreate_EmptyChangesWithCommits * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * Apply review suggestions and add test * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * fix build * test error message * make fmt * Fix indentation issues identified by @silverwind Co-authored-by: silverwind <me@silverwind.io> * Fix tests and make manually merged disabled error on API the same Signed-off-by: Andrew Thornton <art27@cantab.net> * a small nit * fix wrong commit id error * fix bug * simple test * fix test Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Make searching issues by keyword case insensitive on DB (#14848)zeripath2021-03-021-3/+4
| | | | | | | | | | | | Most DBs apart from SQLite will use a default Collation that is not case insensitive. This means that SearchIssuesByKeyword becomes case sensitive for db indexing - in contrast to the bleve and elastic indexers. This PR simply uses UPPER(...) to do the LIKE - and although it may be more efficient to change collations this would be a non-trivial task. Fix #13663 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Migrate to use jsoniter instead of encoding/json (#14841)zeripath2021-03-018-9/+41
| | | | | | | | | | * Migrate to use jsoniter * fix tests * update gitea.com/go-chi/binding Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Repository transfer has to be confirmed, if user can not create repo for new ↵65432021-03-0112-145/+567
| | | | | | | owner (#14792) * make repo as "pending transfer" if on transfer start doer has no right to create repo in new destination * if new pending transfer ocured, create UI & Mail notifications
* All organization members should be assignable as reviewer (#14262)Jimmy Praet2021-02-281-8/+12
| | | | | | For public repos, all organization members should be assignable as reviewer Co-authored-by: zeripath <art27@cantab.net>
* Disable broken OAuth2 providers at startup (#14802)zeripath2021-02-251-1/+7
| | | | | | | | | | Instead of causing a log.Fatal, we should handle broken OAuth2 providers by disabling them. Fix #8930 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Heatmap days clickable (#13935)gordon--2021-02-201-6/+19
| | | | | | | | | | | | | | | | * Heatmap days clickable * Error handling * Unselect filter * better dayclick handler * made linter happy * clickable heatmap for profiles Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Remove unused commit (#14741)Lunny Xiao2021-02-201-5/+3
| | | | | | | | | * Remove unused commit * a small nit Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: a1012112796 <1012112796@qq.com>
* Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL ↵zeripath2021-02-194-5/+5
| | | | | | | | (#12999) Also removes some unnecessary uses of fmt.Sprintf and adds documentation strings Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add UI to delete tracked times (#14100)Norwin2021-02-195-0/+40
| | | Co-authored-by: 6543 <6543@obermui.de>
* models/repo: Fix typo in comment (#14731)Jacob Hrbek2021-02-181-2/+2
| | | | | | | * models/repo: Fix typo in comment * another typo Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* #14699 Make branch names in PR description clickable (#14716)Jimmy Praet2021-02-181-0/+25
|
* Add Password Algorithm option to install page (#14701)zeripath2021-02-161-0/+10
| | | | | | | Add Password Algorithm option to install page Fix #14674 Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Create DB session provider(based on xorm) (#13031)zeripath2021-02-154-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Create Xorm session provider This PR creates a Xorm session provider which creates the appropriate Session table for macaron/session. Fix #7137 Signed-off-by: Andrew Thornton <art27@cantab.net> * extraneous l Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * use key instead of ID to be compatible with go-macaron/session Signed-off-by: Andrew Thornton <art27@cantab.net> * And change the migration too. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update spacing of imports Co-authored-by: 6543 <6543@obermui.de> * Update modules/session/xorm.go Co-authored-by: techknowlogick <matti@mdranta.net> * add xorm provider to the virtual provider Signed-off-by: Andrew Thornton <art27@cantab.net> * prep for master merge * prep for merge master * As per @lunny * move migration out of the way * Move to call this db session as per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add v171 (addSortingColToProjectBoard) migration for #14634 (#14652)65432021-02-123-1/+25
| | | | | | | * add v171 Migration for #14634 * NOT NULL Co-authored-by: Lauris BH <lauris@nix.lv>
* Add dismiss review feature (#12674)a10121127962021-02-1110-34/+87
| | | | | | | | | | | | | | | * Add dismiss review feature refs: https://github.blog/2016-10-12-dismissing-reviews-on-pull-requests/ https://developer.github.com/v3/pulls/reviews/#dismiss-a-review-for-a-pull-request * change modal ui and error message * Add unDismissReview api Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Sort / Move project boards (#14634)Romain2021-02-111-5/+29
| | | Sort Project board (#14533)
* Improve the comment on comment type (#14609)Lunny Xiao2021-02-101-32/+32
|
* Prevent adding nil label to .AddedLabels or .RemovedLabels (#14623)zeripath2021-02-101-0/+10
| | | | | | | | | | | | | | | | | | * Prevent adding nil label to .AddedLabels or .RemovedLabels There are possibly a few old databases out there with malmigrated data that can cause panics with empty labels being migrated. This PR adds a few tests to prevent nil labels being added. Fix #14466 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add doctor command to remove the broken label comments Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Use OldRef instead of CommitSHA for DeleteBranch comments (#14604)zeripath2021-02-083-5/+21
| | | | | | | | Fix #14545 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bug about ListOptions and stars/watchers pagnation (#14556)Lunny Xiao2021-02-042-6/+6
| | | | | | | * Fix bug about ListOptions and stars/watchers pagnation * fix unit test Co-authored-by: 6543 <6543@obermui.de>
* Fix gpg key deletion (#14561)Anton Khimich2021-02-042-1/+15
| | | | | | | | | | | | | | | | | | | * Fix GPG key deletion when user is deleted Per #14531, deleting a user account will delete the user's GPG keys from the `gpg_key` table but not from `gpg_key_import`, which causes an error when creating an account with the same email and attempting to re-add the same key. This commit deletes all entries from `gpg_key_import` that match any GPG key IDs belonging to the user. * Format added code in models/user.go * Create a new function for listing GPG keys and apply it Create a new function `listGPGKeys` and replace a previous use of `ListGPGKeys`. Thanks to @6543 for the patch. Co-authored-by: Anton Khimich <anton.khimicha@mail.utoronto.ca> Co-authored-by: 6543 <6543@obermui.de>
* Set the name Mapper in migrations (#14526)zeripath2021-01-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | Migrations currently uses the default Xorm mapper which is not the same as the mapper Gitea actually uses. This means that there is a difference between the struct parsing and mapping to database tables in migrations as compared to normal Sync2. This was the cause for the catastrophic problem in v168 - untagged fields are not mapped in the same way in migrations as compared to outside of migrations. This is also likely the cause of some weird subtle failures in other migrations as any untagged field may not be being mapped exactly the same way. This PR suggests that we ensure that the mapper is set at the start of the migrations code - but also enforces a strict clean mapper between each migration. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add Doctor FixWrongUserType (#14522)65432021-01-291-1/+11
| | | | | * Add Doctor FixWrongUserType * use NoAutoTime
* noop (#14521)John Olheiser2021-01-291-98/+3
| | | | | Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix migration v141 (#14387)65432021-01-283-1/+109
| | | | | | | | | | | | | | | | | | | | | | | | | * Fix mig 141 * Add Migration to fix it * update null values to false first * Alter Table if posible * use dropTableColumns instead of recreateTable * MySQL use Alter * Postgres use Alter * Update models/migrations/v167.go * Apply suggestions from code review * use 2x add col & 2x update & 2x drop col * let sqlite be the only issue * use recreate since it just WORKS
* Fix bug because of duplicated join (#14454)Lunny Xiao2021-01-261-2/+7
| | | | | | | | | | | | * Fix bug because of duplicated join * Move join into setupsession * Fix bug * Fix bug Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Cron job to cleanup hook_task table (#13080)Brad Albright2021-01-262-0/+201
| | | | | | | | | Close **Prune hook_task Table (#10741)** Added a cron job to delete webhook deliveries in the hook_task table. It can be turned on/off and the schedule controlled globally via app.ini. The data can be deleted by either the age of the delivery which is the default or by deleting the all but the most recent deliveries _per webhook_. Note: I had previously submitted pr #11416 but I closed it when I realized that I had deleted per repository instead of per webhook. Also, I decided allowing the settings to be overridden via the ui was overkill. Also this version allows the deletion by age which is probably what most people would want.
* Redirect on changed user and org name (#11649)Andrew Bezold2021-01-2412-18/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add redirect for user * Add redirect for orgs * Add user redirect test * Appease linter * Add comment to DeleteUserRedirect function * Fix locale changes * Fix GetUserByParams * Fix orgAssignment * Remove debug logging * Add redirect prompt * Dont Export DeleteUserRedirect & only use it within a session * Unexport newUserRedirect * cleanup * Fix & Dedub API code * Format Template * Add Migration & rm dublicat * Refactor: unexport newRepoRedirect() & rm dedub del exec * if this fails we'll need to re-rename the user directory Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Enhance Ghost comment mitigation Settings (#14392)65432021-01-215-26/+57
| | | | | | | | | | | | | | | | | | | | | | | | | * refactor models.DeleteComment and delete related reactions too * use deleteComment for UserDeleteWithCommentsMaxDays in DeleteUser * nits * Use time.Duration as other time settings have * docs * Resolve Fixme & fix potential deadlock * Disabled by Default * Update Config Value Description * switch args * Update models/issue_comment.go Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Allow ssh-keygen on Windows to detect ssh key type (#14413)Chester Liu2021-01-211-5/+0
|
* Display current stopwatch in navbar (#14122)Norwin2021-01-211-0/+10
| | | | | | | | | | | | | | | | | * add notification about running stopwatch to header * serialize seconds, duration in stopwatches api * ajax update stopwatch i should get my testenv working locally... * new variant: hover dialog * noscript compatibility * js: live-update stopwatch time * js live update robustness