summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Fix web notification icon not updated once you read all notifications ↵Giteabot2024-06-241-4/+5
| | | | | | | | | | | | (#31447) (#31466) Backport #31447 by kiatt210 Fix #29065 Remove status filtering from GetUIDsAndNotificationCounts sql. Co-authored-by: kiatt210 <40639725+kiatt210@users.noreply.github.com> Co-authored-by: kiatt210 <kiatt210@github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix duplicate sub-path for avatars (#31365) (#31368)wxiaoguang2024-06-153-2/+60
| | | Backport #31365, only backport necessary changes.
* Fix the possible migration failure on 286 with postgres 16 (#31209) (#31218)Giteabot2024-06-021-1/+1
| | | | | | | Backport #31209 by @lunny Try to fix #31205 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix branch order (#31174) (#31193)Giteabot2024-05-311-8/+4
| | | | | | | | | | Backport #31174 by @lunny Fix #31172 The original order or the default order should not be ignored even if we have an is_deleted order. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Make gitea webhooks openproject compatible (#28435) (#31081)Giteabot2024-05-261-0/+15
| | | | | Backport #28435 by Chief-Detektor Co-authored-by: André Rosenhammer <andre.rosenhammer@gmail.com>
* Fix wrong display of recently pushed notification (#25812) (#31043)yp053272024-05-2312-30/+261
| | | | | | | | | | | Backport #25812 ~~ps: removed some new codes in `tests/integration/pull_merge_test.go`~~ --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix automerge will not work because of some events haven't been triggered ↵Giteabot2024-05-221-3/+3
| | | | | | | | | | | | | | | | | | (#30780) (#31039) Backport #30780 by @lunny Replace #25741 Close #24445 Close #30658 Close #20646 ~Depends on #30805~ Since #25741 has been rewritten totally, to make the contribution easier, I will continue the work in this PR. Thanks @6543 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor sha1 and time-limited code (#31023) (#31030)Giteabot2024-05-212-8/+4
| | | | | Backport #31023 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix data-race during testing (#30999) (#31024)Giteabot2024-05-202-18/+32
| | | | | | | Backport #30999 by wxiaoguang Fix #30992 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Filter out duplicate action(activity) items for a repository (#30957) (#30976)Giteabot2024-05-142-1/+31
| | | | | Backport #30957 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Protected tag is no internal server error (#30962) (#30970)Giteabot2024-05-141-0/+24
| | | | | | | | | | Backport #30962 by @KN4CK3R Fixes #30959 Adds an API test for protected tags. Fix existing tag in combination with fixtures. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Remove If Exist check on migration for mssql because that syntax required ↵Giteabot2024-05-123-10/+12
| | | | | | | | | | | | | | SQL server 2016 (#30894) (#30946) Backport #30894 by @lunny Fix #30872 We will assume the database is consistent before executing the migration. So the indexes should exist. Removing `IF EXIST` then is safe enough. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Fix various problems around projects board view (#30696) (#30902)Giteabot2024-05-086-67/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #30696 by @lunny # The problem The previous implementation will start multiple POST requests from the frontend when moving a column and another bug is moving the default column will never be remembered in fact. # What's changed - [x] This PR will allow the default column to move to a non-first position - [x] And it also uses one request instead of multiple requests when moving the columns - [x] Use a star instead of a pin as the icon for setting the default column action - [x] Inserted new column will be append to the end - [x] Fix #30701 the newly added issue will be append to the end of the default column - [x] Fix when deleting a column, all issues in it will be displayed from UI but database records exist. - [x] Add a limitation for columns in a project to 20. So the sorting will not be overflow because it's int8. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor AppURL usage (#30885) (#30891)wxiaoguang2024-05-082-16/+6
| | | | | | | Backport #30885 Fix #30883 Fix #29591 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Get repo list with OrderBy alpha should respect owner too (#30784) (#30875)Giteabot2024-05-061-2/+2
| | | | | | | | | | | | | | | | | Backport #30784 by @6543 instead of: - zowner/gcode - awesome/nul - zowner/nul - zowner/zzz we will get: - awesome/nul - zowner/gcode - zowner/nul - zowner/zzz Co-authored-by: 6543 <6543@obermui.de>
* Fix no edit history after editing issue's title and content (#30814) (#30845)Giteabot2024-05-031-56/+0
| | | | | | | | | Backport #30814 by @yp05327 Fix #30807 reuse functions in services Co-authored-by: yp05327 <576951401@qq.com>
* Fix duplicate status check contexts (#30660) (#30779)Zettat1232024-05-012-25/+61
| | | | | | | | | | | | | | | | | | | | | Backport #30660. Caused by #30076. There may be some duplicate status check contexts when setting status checks for a branch protection rule. The duplicate contexts should be removed. Before: <img src="https://github.com/go-gitea/gitea/assets/15528715/97f4de2d-4868-47a3-8a99-5a180f9ac0a3" width="600px" /> After: <img src="https://github.com/go-gitea/gitea/assets/15528715/ff7289c5-9793-4090-ba31-e8cb3c85f8a3" width="600px" />
* Get repo assignees and reviewers should ignore deactivated users (#30770) ↵65432024-04-302-7/+23
| | | | | | | | | | | | | (#30782) Backport #30770 If an user is deactivated, it should not be in the list of users who are suggested to be assigned or review-requested. old assignees or reviewers are not affected. --- *Sponsored by Kithara Software GmbH*
* Rename migration package name for 1.22-rc1 (#30730)wxiaoguang2024-04-277-13/+14
| | | Ref: Propose to restart 1.22 release #30501
* Add some tests to clarify the "must-change-password" behavior (#30693)wxiaoguang2024-04-271-2/+10
| | | | | | | | | | Follow #30472: When a user is created by command line `./gitea admin user create`: Old behavior before #30472: the first user (admin or non-admin) doesn't need to change password. Revert to the old behavior before #30472
* Update misspell to 0.5.1 and add `misspellings.csv` (#30573)silverwind2024-04-277-31/+31
| | | | | | Misspell 0.5.0 supports passing a csv file to extend the list of misspellings, so I added some common ones from the codebase. There is at least one typo in a API response so we need to decided whether to revert that and then likely remove the dict entry.
* Improve job commit description (#30579)yp053272024-04-261-0/+11
| | | | | | | | | | | | | | | | | | | | | Fix https://github.com/go-gitea/gitea/issues/30567 When job is a schedule: ![image](https://github.com/go-gitea/gitea/assets/18380374/b07e9d43-e8b7-4ee2-87b3-a7050c3a8ca5) When it is a normal one: ![image](https://github.com/go-gitea/gitea/assets/18380374/0d58dab9-74bb-421b-8952-0578cdf21a52) also add a 'space' behind `:` ![image](https://github.com/go-gitea/gitea/assets/18380374/4cebece0-bfe6-4ad9-b806-e5c49bb9be43) ![image](https://github.com/go-gitea/gitea/assets/18380374/02da7681-474b-4c0f-9dad-b6558f6cb484) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve oauth2 client "preferred username field" logic and the error ↵wxiaoguang2024-04-253-12/+18
| | | | | | | | | | | | | handling (#30622) Follow #30454 And fix #24957 When using "preferred_username", if no such field, `extractUserNameFromOAuth2` (old `getUserName`) shouldn't return an error. All other USERNAME options do not return such error. And fine tune some logic and error messages, make code more stable and more friendly to end users.
* Fix some bug on migrations (#30647)Lunny Xiao2024-04-242-6/+1
| | | Fix https://github.com/go-gitea/gitea/pull/23894#discussion_r1573718690
* Interpolate runs-on with variables when scheduling tasks (#30640)sillyguodong2024-04-232-6/+21
| | | | | | | | | | Follow #29468 1. Interpolate runs-on with variables when scheduling tasks. 2. The `GetVariablesOfRun` function will check if the `Repo` of the run is nil. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Add a db consistency check to remove runners that do not belong to a ↵Zettat1232024-04-231-2/+24
| | | | | repository (#30614) Follow #30406
* Fix wrong table name (#30557)Lunny Xiao2024-04-236-8/+18
| | | | | | The table name should be `oauth2_application` but `o_auth2_application` Caused by https://github.com/go-gitea/gitea/pull/21316/files#diff-9610efbc608a41f1f2eaff5790423f0a187906f6ff0beb23a5e8d18366cc2ccfR38
* Enable more `revive` linter rules (#30608)silverwind2024-04-2212-22/+4
| | | | | | | | | | | Noteable additions: - `redefines-builtin-id` forbid variable names that shadow go builtins - `empty-lines` remove unnecessary empty lines that `gofumpt` does not remove for some reason - `superfluous-else` eliminate more superfluous `else` branches Rules are also sorted alphabetically and I cleaned up various parts of `.golangci.yml`.
* chore: use errors.New to replace fmt.Errorf with no parameters will much ↵Cheng2024-04-213-4/+6
| | | | | better (#30621) use errors.New to replace fmt.Errorf with no parameters will much better
* Fix package list performance (#30520)KN4CK3R2024-04-201-11/+11
| | | | | | | | | Fixes #28255 The new query uses the id field to sort by "newer". This most not be correct (usually it is) but it's faster (see #28255). If someone has a better idea, please propose changes. Co-authored-by: Giteabot <teabot@gitea.io>
* Clarify permission "HasAccess" behavior (#30585)wxiaoguang2024-04-204-28/+84
| | | | | | | | | | | | | | | Follow #30495 "HasAccess" behavior wasn't clear, to make it clear: * Use a new name `HasAnyUnitAccess`, it will be easier to review related code and permission problems. * Separate everyone access mode to a separate field, then all calls to HasAccess are reverted to old behavior before #30495. * Add new tests. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Allow everyone to read or write a wiki by a repo unit setting (#30495)wxiaoguang2024-04-1712-97/+263
| | | | | Replace #6312 Help #5833 Wiki solution for #639
* Refactor web routes (#30519)wxiaoguang2024-04-172-13/+23
| | | | | | | Re-organize the routes in web.go and use ctx constants instead of `context.UnitTypes()` --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Reduce unnecessary database queries on actions table (#30509)Lunny Xiao2024-04-171-0/+6
|
* Improve "must-change-password" logic and document (#30472)wxiaoguang2024-04-141-2/+2
| | | | | Unify the behaviors of "user create" and "user change-password". Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix commitstatus summary (#30431)Lunny Xiao2024-04-143-14/+36
| | | | | | | | | | The target_url is necessary for the UI, but missed in commit_status_summary table. This PR fix it. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Add comment for ContainsRedirectURI about the exact match (#30457)wxiaoguang2024-04-131-0/+5
| | | | Close #26897 Replace #30336
* Fix rename branch 500 when the target branch is deleted but exist in ↵Lunny Xiao2024-04-121-6/+25
| | | | | database (#30430) Fix #30428
* Add commit status summary table to reduce query from commit status table ↵Lunny Xiao2024-04-124-12/+114
| | | | | | | | | | | | (#30223) This PR adds a new table named commit status summary to reduce queries from the commit status table. After this change, commit status summary table will be used for the final result, commit status table will be for details. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Check the token's owner and repository when registering a runner (#30406)Zettat1232024-04-111-0/+3
| | | Fix #30378
* Avoid user does not exist error when detecting schedule actions when the ↵yp053272024-04-111-0/+3
| | | | | | | | | | | | | | | | commit author is an external user (#30357) ![image](https://github.com/go-gitea/gitea/assets/18380374/ddf6ee84-2242-49b9-b066-bd8429ba4d76) When repo is a mirror, and commit author is an external user, then `GetUserByEmail` will return error. reproduce/test: - mirror Gitea to your instance - disable action and enable it again, this will trigger `DetectAndHandleSchedules` ps: also follow #24706, it only fixed normal runs, not scheduled runs.
* Replace MSSQL driver with a better maintained version (#30390)Lunny Xiao2024-04-111-3/+3
| | | | | | | | As the latest tag of `github.com/denisenkom/go-mssqldb` is in 2022, but as a fork of it, `github.com/microsoft/go-mssqldb` has more activities than the original repository. We can convert the driver to the fork. Since the interface of Go database driver are the same, it should have no any affect for the end users.
* Refactor more filterslice (#30370)Lunny Xiao2024-04-103-23/+13
|
* Fix ambiguous id when fetch Actions tasks (#30382)Jason Song2024-04-101-1/+1
| | | | | | | Fix regression of #30331. ```txt time="2024-04-10T02:23:49Z" level=error msg="failed to fetch task" func="[fetchTask]" file="[poller.go:91]" error="unknown: rpc error: code = Internal desc = pick task: CreateTaskForRunner: Error 1052 (23000): Column 'id' in field list is ambiguous" ```
* Add container.FilterSlice function (#30339)oliverpool2024-04-0914-184/+101
| | | | | | | | | | | | | | | | | | | | | | | | | Many places have the following logic: ```go func (jobs ActionJobList) GetRunIDs() []int64 { ids := make(container.Set[int64], len(jobs)) for _, j := range jobs { if j.RunID == 0 { continue } ids.Add(j.RunID) } return ids.Values() } ``` this introduces a `container.FilterMapUnique` function, which reduces the code above to: ```go func (jobs ActionJobList) GetRunIDs() []int64 { return container.FilterMapUnique(jobs, func(j *ActionRunJob) (int64, bool) { return j.RunID, j.RunID != 0 }) } ```
* Avoid running action when action unit is disabled after workflows detected ↵yp053272024-04-081-1/+4
| | | | | | | | | | | | | (#30331) Fix #30243 We only checking unit disabled when detecting workflows, but not in runner `FetchTask`. So if a workflow was detected when action unit is enabled, but disabled later, `FetchTask` will still return these detected actions. Global setting: repo.ENABLED and repository.`DISABLED_REPO_UNITS` will not effect this.
* Fix oauth2 builtin application logic (#30304)wxiaoguang2024-04-081-6/+6
| | | | | | Fix #29074 (allow to disable all builtin apps) and don't make the doctor command remove the builtin apps. By the way, rename refobject and joincond to camel case.
* Clean up log messages (#30313)wxiaoguang2024-04-072-14/+5
| | | | | | `log.Xxx("%v")` is not ideal, this PR adds necessary context messages. Remove some unnecessary logs. Co-authored-by: Giteabot <teabot@gitea.io>
* Fix missing 0 prefix of GPG key id (#30245)KN4CK3R2024-04-023-7/+23
| | | | | | | | | | Fixes #30235 If the key id "front" byte has a single digit, `%X` is missing the 0 prefix. ` 38D1A3EADDBEA9C` instead of `038D1A3EADDBEA9C` When using the `IssuerFingerprint` slice `%X` is enough but I changed it to `%016X` too to be consistent.
* Add unique index for project_issue to prevent duplicate data (#30190)Lunny Xiao2024-04-025-0/+133
| | | Fix #27639