aboutsummaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Fix org label open count, including close count issue (#20365)Tyrone Yeh2022-07-141-0/+2
|
* Only show Followers that current user can access (#20220) (#20253)zeripath2022-07-061-9/+50
| | | | | | | | Backport #20220 Users who are following or being followed by a user should only be displayed if the viewing user can see them. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Check for permission when fetching user controlled issues (#20133) (#20196)Gusted2022-07-012-0/+27
| | | | | | | | | | | | | | | | | | | | | | | * Check if project has the same repository id with issue when assign project to issue * Check if issue's repository id match project's repository id * Add more permission checking * Remove invalid argument * Fix errors * Add generic check * Remove duplicated check * Return error + add check for new issues * Apply suggestions from code review Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de>
* Fix count bug (#19850)Lunny Xiao2022-06-011-4/+5
| | | | | | | * Fix count bug * Fix bug * Fix test
* Make WIP prefixes case insensitive, e.g. allow `Draft` as a WIP prefix ↵Ondřej Čertík2022-05-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | (#19780) (#19811) Backport #19780 The issue was that only the actual title was converted to uppercase, but not the prefix as specified in `WORK_IN_PROGRESS_PREFIXES`. As a result, the following did not work: WORK_IN_PROGRESS_PREFIXES=Draft:,[Draft],WIP:,[WIP] One possible workaround was: WORK_IN_PROGRESS_PREFIXES=DRAFT:,[DRAFT],WIP:,[WIP] Then indeed one could use `Draft` (as well as `DRAFT`) in the title. However, the link `Start the title with DRAFT: to prevent the pull request from being merged accidentally.` showed the suggestion in uppercase; so it is not possible to show it as `Draft`. This PR fixes it, and allows to use `Draft` in `WORK_IN_PROGRESS_PREFIXES`. Fixes #19779. Co-authored-by: zeripath <art27@cantab.net>
* Fix bug (#19757)Lunny Xiao2022-05-201-12/+7
|
* Fix issue overview for teams (#19652) (#19653)Gusted2022-05-162-7/+18
| | | | | - Backport #19652 - Don't use hacky solution to limit to the correct RepoID's, instead use current code to handle these limits. The existing code is more correct than the hacky solution. - Resolves #19636
* Delete user related oauth stuff on user deletion too (#19677) (#19680)65432022-05-121-0/+8
| | | | | | | | | Backport (#19677) * delete user related oauth stuff on user deletion too * extend doctor check-db-consistency * make it build for v1.16.x
* [doctor] Add check/fix for bogus action rows (#19656) (#19669)singuliere2022-05-102-0/+65
| | | | | | | Co-authored-by: Loïc Dachary <loic@dachary.org> Conflicts: models/consistency_test.go trivial context conflict.
* GetFeeds must always discard actions with dangling repo_id (#19598) (#19629)singuliere2022-05-084-6/+33
| | | | | | | | | | | | | | | | Co-authored-by: Loïc Dachary <loic@dachary.org> (cherry picked from commit b536b65189319544939da9b6537919a4fc838d71) Conflicts: models/action_test.go The GetFeeds function does not have a Context argument in 1.16. models/action.go The SQL statement is essentially the same in 1.16 but structured differently. The Join() was copied and the created_unix field prefixed with `action`. models/action_list.go in 1.16 the loadRepoOwner method did not exist and it was done in the RetrieveFeeds method of web/feed/profile.go. The safeguard to skip when act.Repo == nil was moved there.
* Prevent NPE when checking repo units if the user is nil (#19625) (#19630)zeripath2022-05-061-1/+1
| | | | | | | | | | | Backport #19625 CheckRepoUnitUser should tolerate nil users. Fix #19613 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* ignore DNS error when doing migration allow/block check (#19567)wxiaoguang2022-05-021-4/+0
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Respect DefaultUserIsRestricted system default when creating new user ↵Jimmy Praet2022-04-301-2/+35
| | | | (#19310 ) (#19560)
* Fix blame page select range error and some typos (#19503)Lunny Xiao2022-04-261-1/+1
| | | Partially back port from #19500 and fix two typos.
* User specific repoID or xorm builder conditions for issue search (#19475) ↵65432022-04-253-19/+14
| | | | (#19476)
* Set correct PR status on 3way on conflict checking (#19457) (#19458)Gusted2022-04-221-0/+11
| | | | | | | | | - Backport #19457 - When 3-way merge is enabled for conflict checking, it has a new interesting behavior that it doesn't return any error when it found a conflict, so we change the condition to not check for the error, but instead check if conflictedfiles is populated, this fixes a issue whereby PR status wasn't correctly on conflicted PR's. - Refactor the mergeable property(which was incorrectly set and lead me this bug) to be more maintainable. - Add a dedicated test for conflicting checking, so it should prevent future issues with this. - Ref: Fix the latest error for https://gitea.com/gitea/go-sdk/pulls/579 Co-authored-by: zeripath <art27@cantab.net>
* API: Search Issues, dont show 500 if filter result in empty list (#19244) ↵65432022-04-201-15/+16
| | | | | | | | | | | (#19436) Backport #19244 * remove error who is none * use setupSessionNoLimit instead of setupSessionWithLimit when no pagination Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Performance improvement for add team user when org has more than 1000 ↵Lunny Xiao2022-04-011-12/+41
| | | | repositories (#19227) (#19289)
* Move checks for pulls before merge into own function (#19271) (#19277)65432022-03-312-20/+23
| | | | | | | | Backport #19271 Fix: * The API does ignore issue dependencies where Web does not * The API checks if "IsSignedIfRequired" where Web does not - UI probably do but nothing will some to craft custom requests * Default merge message is crafted a bit different between API and Web if not set on specific cases ...
* Only send webhook events to active system webhooks and only deliver to ↵zeripath2022-03-291-4/+9
| | | | | | | | | | | | | | | | | active hooks (#19234) (#19248) Backport #19234 There is a bug in the system webhooks whereby the active state is not checked when webhooks are prepared and there is a bug that deactivating webhooks do not prevent queued deliveries. * Only add SystemWebhooks to the prepareWebhooks list if they are active * At the time of delivery if the underlying webhook is not active mark it as "delivered" but with a failed delivery so it does not get delivered. Fix #19220 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Touch mirrors on even on fail to update (#19217) (#19233)zeripath2022-03-271-0/+8
| | | | | | | | | | Backport #19217 If a mirror fails to be synchronised it should be pushed to the bottom of the queue of the awaiting mirrors to be synchronised. At present if there LIMIT number of broken mirrors they can effectively prevent all other mirrors from being synchronized as their last_updated time will remain earlier than other mirrors. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix showing issues in your repositories (#18916) (#19191)65432022-03-241-1/+6
| | | | | | | - Make a restriction on which issues can be shown based on if you the user or team has write permission to the repository. - Fixes a issue whereby you wouldn't see any associated issues with a specific team on a organization if you wasn't a member(fixed by zeroing the User{ID} in the options). - Resolves #18913 Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Fix the bug: deploy key with write access can not push (#19010) (#19182)zeripath2022-03-232-9/+3
| | | | | | | | | Backport #19010 Use DeployKeyID to replace the IsDeployKey, then CanWriteCode uses the DeployKeyID to check the write permission. Fix #19009 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Cleanup protected branches when deleting users & teams (#19158) (#19174)Norwin2022-03-232-2/+85
| | | | | | | | | | | | | | | | * Clean up protected_branches when deleting user fixes #19094 * Clean up protected_branches when deleting teams * fix issue Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Restrict email address validation (#17688) (#19085)65432022-03-144-10/+95
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Update the webauthn_credential_id_sequence in Postgres (#19048) (#19060)zeripath2022-03-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #19048 There is (yet) another problem with v210 in that Postgres will silently allow preset ID insertions ... but it will not update the sequence value. This PR simply adds a little step to the end of the v210 migration to update the sequence number. Users who have already migrated who find that they cannot insert new webauthn_credentials into the DB can either run: ```bash gitea doctor recreate-table webauthn_credential ``` or ```bash SELECT setval('webauthn_credential_id_seq', COALESCE((SELECT MAX(id)+1 FROM `webauthn_credential`), 1), false) ``` which will fix the bad sequence. Fix #19012 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Improve SyncMirrors logging (#19045) (#19050)zeripath2022-03-101-2/+3
| | | | | | | | | | Backport #19045 Yet another issue has come up where the logging from SyncMirrors does not provide enough context. This PR adds more context to these logging events. Related #19038 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Ignore missing comment for user notifications (#18954) (#19043)zeripath2022-03-101-3/+4
|
* Fix potential assignee query for repo (#18994) (#18999)Otto Richter (fnetX)2022-03-052-1/+19
| | | | | | | | | * Fix potential assignee query for repo * Add tests for `GetRepoAssignees` - As per https://github.com/go-gitea/gitea/pull/18994#issuecomment-1058506640 Co-authored-by: Gusted <williamzijl7@hotmail.com>
* backport fix of #18973 (#18974)65432022-03-021-1/+1
|
* Refactor admin user filter query parameters (#18965) (#18975)Otto Richter (fnetX)2022-03-021-0/+3
| | | | | | Only pass `status_filter` on admin page Use a more general method to pass query parameters, remove hard-coded keys Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Accounts with WebAuthn only (no TOTP) now exist ... fix code to handle that ↵65432022-03-021-6/+20
| | | | case (#18897) (#18964)
* Fix page and missing return on unadopted repos API (#18848) (#18927)qwerty2872022-02-273-2/+2
| | | | | | | * Fix page and missing return on unadopted repos API Page must be 1 if it's not specified and it should return after sending an internal server error. * Allow ignore pages
* Don't update email for organisation (#18905) (#18906)Gusted2022-02-261-1/+1
| | | Backport #18905
* Fix migration v210 (#18893)Lunny Xiao2022-02-251-4/+10
|
* Fix ldap user sync missed email in email_address table (#18786) (#18876)Lunny Xiao2022-02-241-5/+26
| | | * Fix ldap user sync missed email in email_address table (#18786)
* Update assignees check to include any writing team and change org sidebar ↵zeripath2022-02-241-11/+40
| | | | | | | | | | | | | (#18680) (#18873) Backport #18680 Following the merging of #17811 teams can now have differing write and readonly permissions, however the assignee list will not include teams which have mixed perms. Further the org sidebar is no longer helpful as it can't describe these mixed permissions situations. Fix #18572 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix ldap loginname (#18789) (#18804)Lunny Xiao2022-02-221-0/+14
| | | | | | | | | | | | | | | | | | | | | | | * Use email_address table to check user's email when login with email adress * Update services/auth/signin.go * Fix test * Fix test * Fix logging in with ldap username != loginname * Fix if user does not exist yet * Make more clear this is loginName * Fix formatting Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Johan Van de Wauw <johan@gisky.be> Co-authored-by: zeripath <art27@cantab.net>
* Fix bug for get user by email (#18834)Lunny Xiao2022-02-211-12/+2
| | | | | Backport #18833 Fix #18830
* Show fullname on issue edits and gpg/ssh signing info (#18828)Wim2022-02-202-3/+5
| | | Co-authored-by: zeripath <art27@cantab.net>
* remove redundant call to UpdateRepoStats during migration (#18591) (#18794)singuliere2022-02-172-36/+4
| | | | | | | | | | | | | | | | | | | | | | | There is no need to call UpdateRepoStats in the InsertIssues and InsertPullRequests function. They are only called during migration by the CreateIssues and CreateReviews methods of the gitea uploader. The UpdateRepoStats function will be called by the Finish method of the gitea uploader after all reviews and issues are inserted. Calling it before is therefore redundant and the associated SQL requests are not cheap. The statistics tests done after inserting an issue or a pull request are also removed. They predate the implementation of UpdateRepoStats, back when the calculation of the statistics was an integral part of the migration function. The UpdateRepoStats is now tested independantly and these tests are no longer necessary. Signed-off-by: singuliere <singuliere@autistici.org> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Attempt to fix the webauthn migration again - part 3 (#18770) (#18771)zeripath2022-02-1610-253/+190
| | | | | | | | | | Backport #18770 v208.go is seriously broken as it misses an ID() check. We need to no-op and remigrate all of the u2f keys. See #18756 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Increase the size of the webauthn_credential credential_id field (#18739) ↵zeripath2022-02-148-2/+282
| | | | | | | | | | | | | | | | | | | | | (#18756) * Increase the size of the webauthn_credential credential_id field (#18739) Backport #18739 Unfortunately credentialIDs in u2f are 255 bytes long which with base32 encoding becomes 408 bytes. The default size of a xorm string field is only a VARCHAR(255) This problem is not apparent on SQLite because strings get mapped to TEXT there. Fix #18727 Signed-off-by: Andrew Thornton <art27@cantab.net> * Ignore the migrate if u2f_registration is not exist (#18760) Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Let return correct perm (#18675) (#18689)Gusted2022-02-091-1/+6
| | | Backport of #18675
* No longer show the db-downgrade SQL in production (#18654)wxiaoguang2022-02-071-3/+6
|
* Collaborator trust model should trust collaborators (#18539) (#18557)zeripath2022-02-032-6/+6
| | | | | | | | | | | | Backport #18539 There was an unintended regression in #17917 which leads to only repository admin commits being trusted. This PR restores the old logic. Fix #18501 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add `GetUserTeams` (#18499) (#18531)zeripath2022-02-022-10/+55
| | | | | | | | | | | | | | | | | | | | | | | Backport #18499 * Correct use `UserID` in `SearchTeams` - Use `UserID` in the `SearchTeams` function, currently it was useless to pass such information. Now it does a INNER statement to `team_user` which obtains UserID -> TeamID data. - Make OrgID optional. - Resolves #18484 * Seperate searching specific user * Add condition back * Use correct struct type Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix for AvatarURL database type (#18487) (#18529)zeripath2022-02-021-1/+1
| | | | | Backport #18487 Co-authored-by: Viktor Kuzmin <kvaster@gmail.com>
* Only view milestones from current repo (#18414) (#18417)zeripath2022-01-261-16/+0
| | | | | | | | Backport #18414 The endpoint /{username}/{reponame}/milestone/{id} is not currently restricted to the repo. This PR restricts the milestones to those within the repo. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix PR comments UI (#18323)wxiaoguang2022-01-191-1/+1
| | | | | Closes: * Review comment cannot be edited #17768 * Changing PR Comment Resolved State Disables Further Changes #18315