summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Add support for ed25519_sk and ecdsa_sk SSH keys (#13462)Artemis Tosini2021-01-202-17/+35
| | | | | | | | | | | | | | * Add support for ed25519_sk and ecdsa_sk SSH keys These start with sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-nistp256@openssh.com. They are supported in recent versions of go x/crypto/ssh and OpenSSH 8.2 or higher. * skip ssh-keygen Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Project: show referenced PRs in issue cards (#14183)Roberto Santalla2021-01-201-0/+4
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Check if label template exist first (#14384)65432021-01-182-23/+17
| | | | | | | * add check * refactor * rollback repo on error after session closed
* exclude authored PRs from Review Requested filter (#14368)Jimmy Praet2021-01-181-0/+1
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Implement ghost comment mitigation (#14349)65432021-01-171-1/+11
| | | | | | | | | | | | | * Implement ghost comment mitigation Adds a config option USER_DELETE_WITH_COMMENTS_MAX_DAYS to the [service] section. See https://codeberg.org/Codeberg/Discussion/issues/24 for the underlying issue. * cleanup * use setting module correctly * add to docs Co-authored-by: Moritz Marquardt <git@momar.de>
* Add review requested filter on pull request overview (#13701)Jimmy Praet2021-01-171-62/+97
| | | | | | | | | | | | | * Add review requested filter on pull request overview #13682 fix formatting * add review_requested filter to /repos/issues/search API endpoint * only Approve and Reject status should supersede Request status * add support for team reviews * refactor: remove duplication of issue filtering conditions
* Sort issue search results by revelance (#14353)Lauris BH2021-01-162-2/+2
|
* KanBan: be able to set default board (#14147)65432021-01-151-20/+75
| | | | Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net>
* Merge default and system webhooks under one menu (#14244)Lauris BH2021-01-151-17/+3
|
* Use IsProd instead of testing if it's equal. (#14336)Lunny Xiao2021-01-141-2/+2
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Issues overview should not show issues from archived repos (#13220)Elena Neuschild2021-01-129-6/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add lots of comments to user.Issues() * Answered some questions from comments * fix typo in comment * Refac user.Issues(): add func repoIDs * Refac user.Issues(): add func userRepoIDs * Refac user.Issues(): add func issueIDsFromSearch * Refac user.Issues(): improve error handling * Refac user.Issues(): add inline documentation and move variable declarations closer to their usages * Refac user.Issues(): add func repoIDMap * Refac user.Issues(): cleanup * Refac: Separate Issues from Pulls during routing * fix typo in comment * Adapt Unittests to Refactoring * Issue13171: Issue and PR Overviews now ignore archived Repositories * changed some verbatim SQL conditions to builder.Eq * models/issue.go: use OptionalBool properly Co-authored-by: 6543 <6543@obermui.de> * Use IsArchived rather than ExcludeArchivedRepos * fixed broken test after merge * added nil check * Added Unit Test securing Issue 13171 fix * Improved IsArchived filtering in issue.GetUserIssueStats * Removed unused func * Added grouping to avoid returning duplicate repo IDs Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Gitea <gitea@fake.local> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [Refactor] Passwort Hash/Set (#14282)65432021-01-105-21/+145
| | | | | | | | | * move SaltGeneration into HashPasswort and rename it to what it does * Migration: Where Password is Valid with Empty String delete it * prohibit empty password hash * let SetPassword("") unset pwd stuff
* Add option to change username to the admin panel (#14229)65432021-01-101-7/+7
| | | | | Co-authored-by: Bwko <bouwko@gmail.com> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net>
* Do not reload page after adding comments in Pull Request reviews (#13877)Jimmy Praet2021-01-081-20/+45
| | | | | | | | | | | | | | | | Fixed #8861 * use ajax on PR review page * handle review comments * extract duplicate code FetchCodeCommentsByLine was initially more or less copied from fetchCodeCommentsByReview. Now they both use a common findCodeComments function instead * use the Engine that was passed into the method Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Some code improvements (#14266)Lunny Xiao2021-01-061-0/+3
|
* Fix wrong type on hooktask to convert typ from char(16) to varchar(16) (#14148)Lunny Xiao2021-01-064-5/+111
| | | | | | | | | | | | | | | | | | | | | | | | | * Fix wrong type on hooktask to convert typ from char(16) to varchar(16) * Fix bugs * Improve code * Use different trim function for MSSQL * Fix bug * Removed wrong changed line * Removed wrong changed line * Fix nullable * Fix lint * Ignore sqlite on migration * Fix mssql modify column failure * Move modifyColumn to migrations.go so that other migrate function could use it
* Add MirrorInterval to the API (#14163)Paul Barton2021-01-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added MirrorInterval to the API * Remove MirrorInterval from CreateRepository * Removed Duplicate UpdateMirror Function * Updated Error Logging * Update Log Message for is not Mirror Co-authored-by: 6543 <6543@obermui.de> * Delete Debug Statement that snuck in Co-authored-by: zeripath <art27@cantab.net> * Add Check for If Interval is too small * Output to API Call * Add Error Object when time is Less than Min Interval * Frequency Error Message Co-authored-by: zeripath <art27@cantab.net> * Allow Zero Mirror Interval Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Fix avatar bugs (#14217)Lunny Xiao2021-01-021-4/+3
|