aboutsummaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Set SemverCompatible to false for Conan packages (#21275)KN4CK3R2022-10-072-0/+17
| | | | | | | | Fixes #21250 Related #20414 Conan packages don't have to follow SemVer. The migration fixes the setting for all existing Conan and Generic (#20414) packages.
* Tag list should include draft releases with existing tags (#21263)Jason Song2022-10-031-0/+8
| | | | | Before, a tag for a draft release disappeared in the tag list, fix #21262. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add pages to view watched repos and subscribed issues/PRs (#17156)qwerty2872022-09-291-0/+35
| | | | | | | | | | | | | | | | | Adds GitHub-like pages to view watched repos and subscribed issues/PRs This is my second try to fix this, but it is better than the first since it doesn't uses a filter option which could be slow when accessing `/issues` or `/pulls` and it shows both pulls and issues (the first try is #17053). Closes #16111 Replaces and closes #17053 ![Screenshot](https://user-images.githubusercontent.com/80460567/134782937-3112f7da-425a-45b6-9511-5c9695aee896.png) Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Check if email is used when updating user (#21289)Alexander Shimchik2022-09-292-6/+27
| | | | Fix #21075 When updating user data should check if email is used by other users
* Add API endpoint to get changed files of a PR (#21177)qwerty2872022-09-291-2/+2
| | | | | | | | | | This adds an api endpoint `/files` to PRs that allows to get a list of changed files. built upon #18228, reviews there are included closes https://github.com/go-gitea/gitea/issues/654 Co-authored-by: Anton Bracke <anton@ju60.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Ignore port for loopback redirect URIs (#21293)M Hickford2022-09-292-0/+33
| | | | | Following https://datatracker.ietf.org/doc/html/rfc8252#section-7.3 Fixes #21285
* Use absolute links in feeds (#21229)KN4CK3R2022-09-212-3/+12
| | | | | | fixes #20864 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix user visible check (#21210)KN4CK3R2022-09-208-4/+108
| | | | | | | | | | Fixes #21206 If user and viewer are equal the method should return true. Also the common organization check was wrong as `count` can never be less then 0. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [API] teamSearch show teams with no members if user is admin (#21204)65432022-09-191-21/+3
| | | close #21176
* Fix reaction of issues (#21185)Jason Song2022-09-171-4/+15
| | | | | | | | | | | Fix #20860. `CommentID` in `FindReactionsOptions` should be -1 to search reactions with zero comment id. https://github.com/go-gitea/gitea/blob/8351172b6e5221290dc5b2c81e159e2eec0b43c8/models/issues/reaction.go#L108-L121 Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix various typos (#21103)luzpaz2022-09-073-3/+3
| | | | | | | Found via `codespell -q 3 -S ./options/locale,./options/license,./public/vendor,./web_src/fomantic -L actived,allways,attachements,ba,befores,commiter,pullrequest,pullrequests,readby,splitted,te,unknwon` Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix delete user missed some comments (#21067)Lunny Xiao2022-09-051-3/+3
| | | | | | | | | | | | | | | | | There is a mistake in the batched delete comments part of DeleteUser which causes some comments to not be deleted The code incorrectly updates the `start` of the limit clause resulting in most comments not being deleted. ```go if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, start).Find(&comments); err != nil { ``` should be: ```go if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, 0).Find(&comments); err != nil { ``` Co-authored-by: zeripath <art27@cantab.net>
* Webhook for Wiki changes (#20219)Aaron F2022-09-043-1/+12
| | | | | | | | | | | | | | | | | | | Add support for triggering webhook notifications on wiki changes. This PR contains frontend and backend for webhook notifications on wiki actions (create a new page, rename a page, edit a page and delete a page). The frontend got a new checkbox under the Custom Event -> Repository Events section. There is only one checkbox for create/edit/rename/delete actions, because it makes no sense to separate it and others like releases or packages follow the same schema. ![image](https://user-images.githubusercontent.com/121972/177018803-26851196-831f-4fde-9a4c-9e639b0e0d6b.png) The actions itself are separated, so that different notifications will be executed (with the "action" field). All the webhook receivers implement the new interface method (Wiki) and the corresponding tests. When implementing this, I encounter a little bug on editing a wiki page. Creating and editing a wiki page is technically the same action and will be handled by the ```updateWikiPage``` function. But the function need to know if it is a new wiki page or just a change. This distinction is done by the ```action``` parameter, but this will not be sent by the frontend (on form submit). This PR will fix this by adding the ```action``` parameter with the values ```_new``` or ```_edit```, which will be used by the ```updateWikiPage``` function. I've done integration tests with matrix and gitea (http). ![image](https://user-images.githubusercontent.com/121972/177018795-eb5cdc01-9ba3-483e-a6b7-ed0e313a71fb.png) Fix #16457 Signed-off-by: Aaron Fischer <mail@aaron-fischer.net>
* test: use `T.TempDir` to create temporary test directory (#21043)Eng Zer Jun2022-09-041-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | A testing cleanup. This pull request replaces `os.MkdirTemp` with `t.TempDir`. We can use the `T.TempDir` function from the `testing` package to create temporary directory. The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. This saves us at least 2 lines (error check, and cleanup) on every instance, or in some cases adds cleanup that we forgot. Reference: https://pkg.go.dev/testing#T.TempDir ```go func TestFoo(t *testing.T) { // before tmpDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(tmpDir) // now tmpDir := t.TempDir() } ``` Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Add more checks in migration code (#21011)zeripath2022-09-041-1/+1
| | | | | | | | | | | | When migrating add several more important sanity checks: * SHAs must be SHAs * Refs must be valid Refs * URLs must be reasonable Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
* Add another index for Action table on postgres (#21033)zeripath2022-09-032-3/+17
| | | | | | | | | | In #21031 we have discovered that on very big tables postgres will use a search involving the sort term in preference to the restrictive index. Therefore we add another index for postgres and update the original migration. Fix #21031 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Delete unreferenced packages when deleting a package version (#20977)KN4CK3R2022-09-032-2/+78
| | | | | Delete a package if its last version got deleted. Otherwise removing the owner works only after the clean up job ran. Fix #20969
* Kd/ci playwright go test (#20123)Kyle D2022-09-023-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add initial playwright config * Simplify Makefile * Simplify Makefile * Use correct config files * Update playwright settings * Fix package-lock file * Don't use test logger for e2e tests * fix frontend lint * Allow passing TEST_LOGGER variable * Init postgres database * use standard gitea env variables * Update playwright * update drone * Move empty env var to commands * Cleanup * Move integrations to subfolder * tests integrations to tests integraton * Run e2e tests with go test * Fix linting * install CI deps * Add files to ESlint * Fix drone typo * Don't log to console in CI * Use go test http server * Add build step before tests * Move shared init function to common package * fix drone * Clean up tests * Fix linting * Better mocking for page + version string * Cleanup test generation * Remove dependency on gitea binary * Fix linting * add initial support for running specific tests * Add ACCEPT_VISUAL variable * don't require git-lfs * Add initial documentation * Review feedback * Add logged in session test * Attempt fixing drone race * Cleanup and bump version * Bump deps * Review feedback * simplify installation * Fix ci * Update install docs
* Fix missed sort bug (#20996)Lunny Xiao2022-08-311-0/+2
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* fix hard-coded timeout and error panic in API archive download endpoint (#20925)Peter Gardfjäll2022-08-292-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix hard-coded timeout and error panic in API archive download endpoint This commit updates the `GET /api/v1/repos/{owner}/{repo}/archive/{archive}` endpoint which prior to this PR had a couple of issues. 1. The endpoint had a hard-coded 20s timeout for the archiver to complete after which a 500 (Internal Server Error) was returned to client. For a scripted API client there was no clear way of telling that the operation timed out and that it should retry. 2. Whenever the timeout _did occur_, the code used to panic. This was caused by the API endpoint "delegating" to the same call path as the web, which uses a slightly different way of reporting errors (HTML rather than JSON for example). More specifically, `api/v1/repo/file.go#GetArchive` just called through to `web/repo/repo.go#Download`, which expects the `Context` to have a `Render` field set, but which is `nil` for API calls. Hence, a `nil` pointer error. The code addresses (1) by dropping the hard-coded timeout. Instead, any timeout/cancelation on the incoming `Context` is used. The code addresses (2) by updating the API endpoint to use a separate call path for the API-triggered archive download. This avoids producing HTML-errors on errors (it now produces JSON errors). Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
* Add support for Vagrant packages (#20930)KN4CK3R2022-08-292-0/+8
| | | | | | | | | | | | | | | | | | * Add support for Vagrant boxes. * Add authentication. * Add tests. * Add integration tests. * Add docs. * Add icons. * Update routers/api/packages/api.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Only show relevant repositories on explore page (#19361)Gusted2022-08-251-2/+29
| | | | | | | Adds a new option to only show relevant repo's on the explore page, for bigger Gitea instances like Codeberg this is a nice option to enable to make the explore page more populated with unique and "high" quality repo's. A note is shown that the results are filtered and have the possibility to see the unfiltered results. Co-authored-by: vednoc <vednoc@protonmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: 6543 <6543@obermui.de>
* Move some files into models' sub packages (#20262)Lunny Xiao2022-08-2543-1088/+567
| | | | | | | | | | | | | | | | | | | | | | | | | * Move some files into models' sub packages * Move functions * merge main branch * Fix check * fix check * Fix some tests * Fix lint * Fix lint * Revert lint changes * Fix error comments * Fix lint Co-authored-by: 6543 <6543@obermui.de>
* Increase Content field size of gpg_key and public_key to MEDIUMTEXT (#20896)zeripath2022-08-225-4/+38
| | | | | | | | | | | Unfortunately some keys are too big to fix within the 65535 limit of TEXT on MySQL this causes issues with these large keys. Therefore increase these fields to MEDIUMTEXT. Fix #20894 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix SQL Query for `SearchTeam` (#20844)Gusted2022-08-213-13/+32
| | | | | | | | | | - Currently the function takes in the `UserID` option, but isn't being used within the SQL query. This patch fixes that by checking that only teams are being returned that the user belongs to. Fix #20829 Co-authored-by: delvh <dev.lh@web.de>
* Pad GPG Key ID with preceding zeroes (#20878)zeripath2022-08-211-0/+9
|
* In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it ↵zeripath2022-08-182-8/+12
| | | | (#20837)
* Remove calls to load Mirrors in user.Dashboard (#20855)zeripath2022-08-181-53/+0
| | | | | | | | | | | | Whilst looking at #20840 I noticed that the Mirrors data doesn't appear to be being used therefore we can remove this and in fact none of the related code is used elsewhere so it can also be removed. Related #20840 Related #20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix migration file name (#20843)Lunny Xiao2022-08-182-2/+1
|
* Check Mirror exists before linking its Repo (#20840)zeripath2022-08-181-1/+3
| | | | | | | | | | | | | | | | | | | | | In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries from the database. This assumes that every Repository which has IsMirror set has a Mirror associated in the DB. This association is incorrect in the case of Mirror repository under creation when there is no Mirror entry in the DB until completion. Unfortunately LoadAttributes makes this incorrect assumption and presumes that a Mirror will always be loaded. This then causes a panic. This PR simply double checks if there a Mirror before attempting to link back to its Repo. Unfortunately it should be expected that there may be other cases where this incorrect assumption causes further problems. Fix #20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add badge capabilities to users (#20607)techknowlogick2022-08-184-0/+74
| | | | | Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Fix panic when an invalid oauth2 name is passed (#20820)Balki2022-08-171-1/+5
|
* Add migrate repo archiver and packages storage support on command line (#20757)Lunny Xiao2022-08-165-92/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add migrate repo archiver and packages storage support on command line * Fix typo * Use stdCtx * Use packageblob and fix command description * Add migrate packages unit tests * Fix comment year * Fix the migrate storage command line description * Update cmd/migrate_storage.go Co-authored-by: zeripath <art27@cantab.net> * Update cmd/migrate_storage.go Co-authored-by: zeripath <art27@cantab.net> * Update cmd/migrate_storage.go Co-authored-by: zeripath <art27@cantab.net> * Fix test Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Refactor AssertExistsAndLoadBean to use generics (#20797)Lunny Xiao2022-08-1641-363/+363
| | | | | | | * Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
* Refactor legacy git init (#20376)wxiaoguang2022-08-092-9/+3
| | | | | | | | * merge `CheckLFSVersion` into `InitFull` (renamed from `InitWithSyncOnce`) * remove the `Once` during git init, no data-race now * for doctor sub-commands, `InitFull` should only be called in initialization stage Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add issue filter for Author (#20578)parnic2022-08-081-0/+12
| | | This adds a new filter option on the issues and pulls pages to filter by the author/poster/creator of the issue or PR
* Fix v220 migration to be compatible for MSSQL 2008 r2 (#20702)Lunny Xiao2022-08-081-10/+9
|
* Add support for Pub packages (#20560)KN4CK3R2022-08-072-0/+8
| | | | | | | | | | | * Added support for Pub packages. * Update docs/content/doc/packages/overview.en-us.md Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Check webhooks slice length before calling xorm (#20642)Gabriel Vasile2022-08-041-0/+4
| | | | | | | xorm.db.Insert errors for empty slices. Fixes: #20641 Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add new API endpoints for push mirrors management (#19841)Mohamed Sekour2022-07-302-28/+54
| | | | | | | | | | | - Add a new push mirror to specific repository - Sync now ( send all the changes to the configured push mirrors ) - Get list of all push mirrors of a repository - Get a push mirror by ID - Delete push mirror by ID Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* WebAuthn CredentialID field needs to be increased in size (#20530)zeripath2022-07-309-14/+362
| | | | | | | | | | | | | WebAuthn have updated their specification to set the maximum size of the CredentialID to 1023 bytes. This is somewhat larger than our current size and therefore we need to migrate. The PR changes the struct to add CredentialIDBytes and migrates the CredentialID string to the bytes field before another migration drops the old CredentialID field. Another migration renames this field back. Fix #20457 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Modify milestone search keywords to be case insensitive again (#20513)Tyrone Yeh2022-07-283-11/+27
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: delvh <dev.lh@web.de>
* Added email notification option to receive all own messages (#20179)Tyrone Yeh2022-07-282-3/+8
| | | | | | Sometimes users want to receive email notifications of messages they create or reply to, Added an option to personal preferences to allow users to choose Closes #20149
* Add Docker /v2/_catalog endpoint (#20469)KN4CK3R2022-07-287-43/+135
| | | | | | | | | | | | | * Added properties for packages. * Fixed authenticate header format. * Added _catalog endpoint. * Check owner visibility. * Extracted condition. * Added test for _catalog. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Hide internal package versions (#20492)KN4CK3R2022-07-271-2/+4
| | | | | * Hide internal versions from most searches. * Added test.
* Display project in issue list (#20434)aceArt-GmbH2022-07-261-0/+45
| | | Co-authored-by: lukas <lukas.walter@aceart.de>
* Fix: Actor is required to get user repositories (#20443)Dhruv Manilawala2022-07-211-0/+4
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Simplify visibility checks (#20406)KN4CK3R2022-07-211-11/+4
| | | | | | | Was looking into the visibility checks because I need them for something different and noticed the checks are more complicated than they have to be. The rule is just: user/org is visible if - The doer is a member of the org, regardless of the org visibility - The doer is not restricted and the user/org is public or limited
* Dismiss prior pull reviews if done via web in review dismiss (#20197)65432022-07-191-0/+30
|
* Fix commit status icon when in subdirectory (#20285)silverwind2022-07-151-0/+1
| | | | | | When viewing a subdirectory and the latest commit to that directory in the table, the commit status icon incorrectly showed the status of the HEAD commit instead of the latest for that directory.