summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* System-wide webhooks (#10546)James Lakin2020-03-093-19/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Create system webhook column (and migration) * Create system webhook DB methods Based on the default webhook ones * Modify router to handle system webhooks and default ones * Remove old unused admin nav template * Adjust orgRepoCtx to differentiate system and default webhook URLs * Assign IsSystemWebhook when creating webhooks * Correctly use booleans for IsSystemWebhook * Use system webhooks when preparing webhooks for payload * Add UI and locale changes * Use router params to differentiate admin hook pages * Fix deleting admin webhooks and rename method * Add clarity to webhook docs * Revert "Remove old unused admin nav template" This reverts commit 191a20a7389fe5f6256b0ad6aafd04b9b0e295c5. * Rename WebHooksNewPost to GiteaHooksNewPost for clarity * Reintroduce blank line lost during merge conflict Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix migration (#10641)John Olheiser2020-03-061-21/+34
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Granular webhook events (#9626)John Olheiser2020-03-064-22/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add PR reviews and API coverage Signed-off-by: jolheiser <john.olheiser@gmail.com> * Split up events Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add migration and locale Signed-off-by: jolheiser <john.olheiser@gmail.com> * Format Signed-off-by: jolheiser <john.olheiser@gmail.com> * Revert IsPull Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix comments Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix tests Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix PR reviews Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix issue_comment Signed-off-by: jolheiser <john.olheiser@gmail.com> * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Migrations Signed-off-by: jolheiser <john.olheiser@gmail.com> * Backwards compatible API Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix feishu Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move session commit Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Add Approval Counts to pulls list (#10238)zeripath2020-03-062-0/+53
| | | | | | | | | * Add Approval Counts to pulls list Add simple approvals counts to pulls lists * Remove non-official counts * Add PR features to milestone_issues.tmpl
* Migration for deleting orphaned dependencies (#10617)Antoine GIRARD2020-03-052-0/+20
| | | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Delete dependencies when deleting a repository (#10608)Lauris BH2020-03-051-0/+12
| | | | | Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add migration to fix the old broken merge-bases (#10604)Lauris BH2020-03-052-0/+99
| | | | | | | | | | | | | * Add migration * Fix migration * Update models/migrations/v128.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Add restricted user filter to LDAP authentication (#10600)Lauris BH2020-03-052-26/+43
| | | | | | * Add restricted user filter to LDAP authentification * Fix unit test cases
* OAuth2: add Yandex provider (#8335) (#10564)Lauris BH2020-03-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | * OAuth2: add Yandex provider (#8335) * remove changes from locale ru-RU * fmt modules/auth/oauth2/oauth2.go Co-Authored-By: 6543 <6543@obermui.de> * fix fmt * Update templates/admin/auth/new.tmpl * fix fmt Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* nextcloud oauth (#10562)techknowlogick2020-03-021-3/+11
| | | Fix #7078
* Display pull request head branch even the branch deleted or repository ↵Lunny Xiao2020-03-023-60/+56
| | | | | | | | | | | | | | | | deleted (#10413) * Display pull request head branch even the branch deleted or repository deleted * Merge getHeadRepo/loadHeadRepo and getBaseRepo/loadBaseRepo on pull and fill repo when pr.Issue.Repo is available * retrieve sha from pull head when pull request branch deleted and fix tests * Fix test * Ensure MustHeadRepoName returns empty string if no head repo Co-authored-by: zeripath <art27@cantab.net>
* Admin page for managing user e-mail activation (#10557)guillep2k2020-03-022-16/+331
| | | | | | | | | | | | | | | | | | | | | | | | * Implement mail activation admin panel * Add export comments * Fix another export comment * again... * And again! * Apply suggestions by @lunny * Add UI for user activated emails * Make new activation UI work * Fix lint * Prevent admin from self-deactivate; add modal Co-authored-by: zeripath <art27@cantab.net>
* Fix migration bug on v96.go (#10572)Lunny Xiao2020-03-021-16/+31
|
* Remove Unused Functions (#10516)65432020-03-023-46/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * remove ReplaceLeft * remove GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName * remove CheckUnitUser chainload to models.CheckUnitUser * remove MakeAssigneeList * remove DownloadDiff & DownloadPatch -> DownloadDiffOrPatch * remove GetRandomBytesAsBase64 * remove PushUpdateDeleteTags * remove GetUserByKeyID (you still can resolve user by "k, err := GetPublicKeyByID; userID := k.OwnerID") * remove BasicAuthEncode from struct package -> same function in modules/base/tools ! * remove UserID from api.utils * remove unused func from structs package
* issue search on my related repositories (#9758)Brad Albright2020-02-292-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* adds API endpoints to manage OAuth2 Application (list/create/delete) (#10437)Gustavo Marin2020-02-291-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | * add API endpoint to create OAuth2 Application. * move endpoint to /user. Add swagger documentations and proper response type. * change json tags to snake_case. add CreateOAuth2ApplicationOptions to swagger docs. * change response status to Created (201) * add methods to list OAuth2 apps and delete an existing OAuth2 app by ID. * add APIFormat convert method and file header * fixed header * hide secret on oauth2 application list * add Created time to API response * add API integration tests for create/list/delete OAuth2 applications. Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* [Refactor] move APIFormat() of Issue and Label to convert package (#10423)65432020-02-284-94/+10
| | | | | | | | | | | | | | | | | | | * Label: delete .APIFormat() and use convert.ToLabel() * move issue APIFormat too * add missing one * move TEST too * handle error -> return empty APIIssue * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* inform participants on UI too (#10473)65432020-02-283-27/+43
| | | | | | | | * inform participants on UI too * ajust test * refactor getParticipantIDsByIssue
* Fix potential bugs (#10513)65432020-02-274-4/+8
| | | | | | | * use e if it is an option * potential nil so check err first * check err first * m == nil already checked
* Show Signer in commit lists and add basic trust (#10425)zeripath2020-02-272-3/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Show Signer in commit lists and add basic trust Show the avatar of the signer in the commit list pages as we do not enforce that the signer is an author or committer. This makes it clearer who has signed the commit. Also display commits signed by non-members differently from members and in particular make it clear when a non-member signer is different from the committer to help reduce the risk of spoofing. Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure orange text and background is available Signed-off-by: Andrew Thornton <art27@cantab.net> * Update gpg_key.go * Update models/gpg_key.go * Apply suggestions from code review * Require team collaborators to have access to UnitTypeCode * as per @6543 * fix position of sha as per @silverwind * as per @guillep2k
* [BugFix] Avoid mailing explicit unwatched (#10475)65432020-02-271-3/+3
| | | | | | | | | | * Avoid mailing explicit unwatched * CI.restart() * back to normal Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Fix SQLite concurrency problems by using BEGIN IMMEDIATE (#10368)guillep2k2020-02-271-1/+1
| | | | | | | | | * Test locking immediate for SQLite3 * fix url field separator Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Show the username as a fallback on feeds if full name is blank (#10438)James Lakin2020-02-262-5/+10
| | | | | Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Code Refactor of IssueWatch related things (#10401)65432020-02-264-71/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor * optimize * remove Iretating function LoadWatchUsers do not load Users into IW object and it is used only in api ... so move this logic * remove unessesary * Apply suggestions from code review Thx Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * make Tests more robust * fix rebase * restart CI * CI no dont hit sqlites deadlock Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* FIX Pagination of ListAccessTokens and GetIssueWatchers (#10449)65432020-02-242-5/+7
| | | | | | * fix a pagination bug * fix pagination of ListAccessTokens
* Various fixes in login sources (#10428)guillep2k2020-02-233-14/+37
|
* Handle push rejection message in Merge & Web Editor (#10373)zeripath2020-02-221-0/+48
| | | | | | | | | | | | | | | | | | * Handle push rejection message in Merge * placate golangci-lint * Fix sanitize, adjust message handling * oops * Oops * Handle push-rejection in webeditor CRUD too * Apply suggestions from code review Co-authored-by: Lauris BH <lauris@nix.lv>
* Ensure only own addresses are updated (#10397)guillep2k2020-02-212-2/+2
|
* Fix wrong num closed issues on repository when close issue via commit (#10364)Lunny Xiao2020-02-201-0/+4
| | | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix test (#10363)Lunny Xiao2020-02-191-0/+1
|
* Reading pull attachments should depend on read UnitTypePullRequests (#10346)zeripath2020-02-182-2/+6
| | | | | | | | * Make pull attachments depend on read UnitTypePullRequests Fixes #10336 * Fix test
* Fix migration information update bug when linked github account (#10310)Lunny Xiao2020-02-172-13/+16
| | | | | | | | * Fix bug on upgrade migrated reactions * Fix migration information update bug when linked github account Co-authored-by: zeripath <art27@cantab.net>
* Blacklist manifest.json & milestones user (#10292)techknowlogick2020-02-161-0/+2
| | | Fix #10290
* Divide GetIssueStats query in smaller chunks (#10176)guillep2k2020-02-152-0/+36
| | | | | | | | | | | | | | | | | | | | * Divide GetIssueStats query in smaller chunks * Skip chunking if count is low enough * Fix lint * Define maxQueryParameters * Remove absMaxQueryParameters because of lint * Restart CI * Restart CI Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Move fixture generation to contrib and add test (#10277)guillep2k2020-02-154-56/+87
| | | | | | | | | | | | | | | | | | * Add fixture gen tool and fix "access" test * Close file before exiting * Add missing repo_unit for repo id: 5 * Fix count on TestAPIOrgRepos * Generate access fixture from contrib and add test * Remove old access fixture generation * Fix lint Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix "access" fixtures and tests (#10247)guillep2k2020-02-155-38/+186
| | | | | | | | | | | | * Add fixture gen tool and fix "access" test * Close file before exiting * Add missing repo_unit for repo id: 5 * Fix count on TestAPIOrgRepos Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Index code and stats only for non-empty repositories (#10251)Lauris BH2020-02-143-5/+17
| | | | | Fix test and switch to unique queue Fix MySQL support when deleting old statistics
* Add API branch protection endpoint (#9311)David Svantesson2020-02-122-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add API branch protection endpoint * lint * Change to use team names instead of ids. * Status codes. * fix * Fix * Add new branch protection options (BlockOnRejectedReviews, DismissStaleApprovals, RequireSignedCommits) * Do xorm query directly * fix xorm GetUserNamesByIDs * Add some tests * Improved GetTeamNamesByID * http status created for CreateBranchProtection * Correct status code in integration test Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Add feishu webhook support (#10229)Lunny Xiao2020-02-121-0/+4
| | | | Add feishu webhook support
* Language statistics bar for repositories (#8037)Lauris BH2020-02-117-32/+274
| | | | | | | | | | | | | | | | | | * Implementation for calculating language statistics Impement saving code language statistics to database Implement rendering langauge stats Add primary laguage to show in repository list Implement repository stats indexer queue Add indexer test Refactor to use queue module * Do not timeout for queues
* Only check for conflicts/merging if the PR has not been merged in the ↵zeripath2020-02-101-18/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interim (#10132) * Only check for merging if the PR has not been merged in the interim * fixup! Only check for merging if the PR has not been merged in the interim * Try to fix test failure * Use PR2 not PR1 in tests as PR1 merges automatically * return already merged error * enforce locking * enforce locking - fix-test * enforce locking - fix-testx2 * enforce locking - fix-testx3 * move pullrequest checking to after merge This might improve the chance that the race does not affect us but does not prevent it. * Remove minor race with getting merge commit id * fixup * move check pr after merge * Remove unnecessary prepareTestEnv - onGiteaRun does this for us * Add information about when merging occuring * fix fmt * More logging * Attempt to fix mysql * Try MySQL fix again * try again * Try again?! * Try again?! * Sigh * remove the count - perhaps that will help * next remove the update id * next remove the update id - make it updated_unix instead * On failure to merge ensure that the pr is rechecked for conflict errors * On failure to merge ensure that the pr is rechecked for conflict errors * Update models/pull.go * Update models/pull.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* [API] Fix inconsistent label color format (#10129)65432020-02-093-35/+52
| | | | | | | | | | | | | | | | * update and use labelColorPattern * add TestCases * fix lint * # optional for templates * fix typo * some more * fix lint of **master**
* Fix invalid repo urls after change username (#10150)mavenbline2020-02-081-1/+11
| | | | | | | | | * Fix invalid repo urls after change username * Update user.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Ensure DeleteUser is not allowed to Delete Orgs and visa versa (#10134)65432020-02-044-6/+13
| | | | | | | | | | | | | | * add check to DeleteUser * add check to DeleteOrganization * add Test * remove redundancy (deleteOrg is only used in DeleteOrganization) * Update models/org.go Co-authored-by: zeripath <art27@cantab.net>
* [API] expose RepoOwner on Issue responce (#10126)65432020-02-041-0/+1
| | | | | | * add RepoOwner on issue api responce * CI.restart()
* Move PushUpdateAddDeleteTags to repository module from models (#10106)Lunny Xiao2020-02-034-162/+38
| | | | | | * Move PushUpdateAddDeleteTags to repository module from models * Fix deadlock on sqlite
* [BugFix] [API] Pull.API.Convert: Only try to get HeadBranch if HeadRepo ↵65432020-01-311-0/+3
| | | | | | | | | | | | | | exist (#10029) * only try to get HeadBranch if HeadRepo exist * impruve * no nil error * add TEST * correct error msg
* Remove migration support from versions earlier than 1.6.0 (#10026)guillep2k2020-01-3157-3440/+45
| | | | | | | | | | | | | | * Remove migration support from versions earlier than 1.6.0 * Remove unused functions * Update gogs upgrade instructions * Improve "latest" link as per @jolheiser Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Update topics repo count when deleting repository (#10051)Lauris BH2020-01-314-3/+54
| | | | | | | | * Update topics repo count when deleting repository * Add migration to fix incorrect data * Optimize to use single update to recalculate values
* Fix milestone API state parameter unhandled (#10049)Lunny Xiao2020-01-292-4/+25
| | | | | | * Fix milestone API state parameter unhandled * Fix test