summaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* [Backport] Fix comment broken issue ref dependence (#12651) (#12692)65432020-09-031-0/+5
| | | | | | | * deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too * Ignore ErrIssueNotExist on comment.LoadDepIssueDetails() * CI.restart()
* Default empty merger list to those with write permissions (#12535) (#12560)zeripath2020-08-221-2/+3
| | | | | | | | | Backport #12535 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* models: break out of loop (#12386) (#12561)zeripath2020-08-221-1/+2
| | | | | Backport #12386 Co-authored-by: Lars Lehtonen <lars.lehtonen@gmail.com>
* Keys should not verify revoked email addresses (#12486) (#12495)zeripath2020-08-171-0/+3
| | | | | | | | | Backport #12486 Fix #6778 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bug preventing transfer to private organization (#12497) (#12501)techknowlogick2020-08-172-5/+5
| | | | | | | | | | | | | | | | | | | * Fix bug preventing transfer to private organization The code assessing whether a private organization was visible to a user before allowing transfer was incorrect due to testing membership the wrong way round This PR fixes this issue and renames the function performing the test to be clearer. Further looking at the API for transfer repository - no testing was performed to ensure that the acting user could actually see the new owning organization. Signed-off-by: Andrew Thornton <art27@cantab.net> * change IsUserPartOfOrg everywhere Co-authored-by: zeripath <art27@cantab.net>
* Extend Notifications API and return pinned notifications by default (#12164) ↵zeripath2020-07-131-3/+3
| | | | | | | | | | | | | (#12232) Backport #12164 This PR extends the notifications API to allow specific notification statuses to be searched for and to allow setting of notifications to statuses other than read. By default unread and pinned statuses will be returned when querying for notifications - however pinned statuses will not be marked as read. Close #12152 Signed-off-by: Andrew Thornton art27@cantab.net
* Decrease the num_stars when deleting a repo (#11954) (#12188)赵智超2020-07-082-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Decrease the num_stars when deleting a repo fix #11949 Signed-off-by: a1012112796 <1012112796@qq.com> * Add migration * use batch * Apply suggestions from code review Co-authored-by: Lauris BH <lauris@nix.lv> * fix lint * fix lint * fix ci * fix ci2 * add doctor * duplicate code * fix migration * fix some nits * add start 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: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Trim to 255 runes instead of bytes (#12150)Jürgen Hötzel2020-07-071-4/+5
| | | | | | | | | | | | | | * Trim to 255 runes instead of bytes Prevents invalid UTF-8 encoding for Description and Website. Refs #7905 * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Ensure Subkeys are verified (#12155) (#12168)zeripath2020-07-061-1/+41
| | | | | | | | | | | | | | | | | Backport #12155 When attempting to verify subkeys the email address verification step requires checking the emails however, these emails are not stored on subkeys but instead on the primary key. This PR will obtain the primaryKey and check against these emails too. Fix #12128 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add serviceworker.js to KnownPublicEntries (#11992) (#11994)silverwind2020-06-201-7/+4
| | | | | Fixes a wrong 302 redirect to the login page, see https://github.com/go-gitea/gitea/issues/11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication.
* Fix commenting on non-utf8 encoded files (#11916) (#11950)65432020-06-181-1/+31
| | | | | | | | | | | * Add comment on non-unicode line to force fail Signed-off-by: Andrew Thornton <art27@cantab.net> * Just quote/unquote patch Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Use google/uuid to instead satori/go.uuid (#11943) (#11946)Lunny Xiao2020-06-185-10/+10
| | | | | | Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net>
* Use ID or Where to instead directly use Get when load object from database ↵65432020-06-179-28/+25
| | | | | | | | | | (#11925) (#11934) Backport #11925 Use ID or Where to instead directly use Get when load object from database Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Invalidate comments when file is shortened (#11882) (#11884)zeripath2020-06-151-1/+4
| | | | | | | Backport #11882 Fix #10686 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Rework api/user/repos for pagination (#11827) (#11877)Cirno the Strongest2020-06-132-8/+15
| | | | | | | | | | | | | | | * Add count to `GetUserRepositories` so that pagination can be supported for `/user/{username}/repos` * Rework ListMyRepos to use models.SearchRepository ListMyRepos was an odd one. It first fetched all user repositories and then tried to supplement them with accessible map. The end result was that: * Limit for pagination did not work because accessible repos would always be appended * The amount of pages was incorrect if one were to calculate it * When paginating, all accessible repos would be shown on every page Hopefully it should now work properly. Fixes #11800 and does not require any change on Drone-side as it can properly interpret and act on Link header which we now set. Co-authored-by: Lauris BH <lauris@nix.lv> (cherry picked from commit 0159851cc3fa80e4df4908a5e760afa20452f712)
* Add doctor check to set IsArchived false if it is null (partial backport ↵zeripath2020-06-111-0/+12
| | | | | | | | | | | | | #11853) (#11859) Partial backport of #11853 Add doctor check to set IsArchived false if it is null. (Migration change unfortunately not possible to be backported.) Fix #11824 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use DEFAULT_PAGING_NUM instead of MAX_RESPONSE_ITEMS in ListOptions (#11831) ↵Cirno the Strongest2020-06-101-1/+4
| | | | | | (#11836) Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit 2b2b3e4c3726ef224e87bb444340bebd3a70badb)
* Increase maximum SQLite variables count to 32766 (#11696) (#11783)Cirno the Strongest2020-06-071-10/+0
| | | | | | | | | | | | * Increase maximum SQLite variables count to 32766 (#11696) per https://www.sqlite.org/limits.html Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit a5aa5c58c1bf5a0c91226e0cbbd7b95bb8f74692) * Fix missing CGO_EXTRA_FLAGS build arg for docker Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix verification of subkeys of default gpg key (#11713) (#11747)zeripath2020-06-031-0/+15
| | | | | | | | | | | | | | | | | * Fix verification of subkeys of default gpg key Fix #10309 Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove debug log * Update models/gpg_key.go * As per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Change language statistics to save size instead of percentage (#11681) (#11690)Lauris BH2020-06-023-18/+107
| | | | | | | | | | | | | | | | | | | | | | | * Change language statistics to save size instead of percentage (#11681) * Change language statistics to save size instead of percentage in database Co-Authored-By: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> * Do not exclude if only language * Fix edge cases with special langauges Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> * Fix language stat calculation (#11692) * Fix language stat calculation * Group languages and ignore 0 size files * remove unneeded code Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
* Add logging to long migrations (#11647) (#11691)zeripath2020-05-304-13/+154
| | | | | | | * Add logging to long migrations Also fix v136 to not use models Signed-off-by: Andrew Thornton <art27@cantab.net>
* Doctor check & fix db consistency (#11111) (#11676)65432020-05-294-62/+190
| | | | | | | | | | | | | | | | needed to fix issue as described in #10280 * rename check-db to check-db-version * add check-db-consistency: * find issues without existing repository * find pulls without existing issues * find tracked times without existing issues/pulls * find labels without repository or org reference Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Handle expected errors in AddGPGkey API (#11644) (#11661)65432020-05-281-1/+1
| | | | | | | | | * handle GPG Parse & Email Errors * correct TEST * update Swagger * more Docu
* Fix wrong milestone in webhook message (#11596) (#11611)Gary Kim2020-05-251-1/+1
| | | | | | | | Backport of #11596 Signed-off-by: Gary Kim <gary@garykim.dev> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Allow different HardBreaks settings for documents and comments (#11515) (#11599)zeripath2020-05-241-4/+19
| | | | | | | | | | | | | | | GH has different HardBreaks behaviour for markdown comments and documents. Comments have hard breaks and documents have soft breaks - therefore Gitea's rendering will always be different from GH's if we only provide one setting. Here we split the setting in to two - one for documents and one for comments and other things. Signed-off-by: Andrew Thornton art27@cantab.net Changes to index.js as per @silverwind Co-authored-by: silverwind <me@silverwind.io> Changes to docs as per @guillep2k Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Fix repo-list private and total count bugs (#11500) (#11532)zeripath2020-05-211-10/+6
| | | | | | | | | | | | | | | | | | | | | * Fix repo-list private and total count bugs Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure limited and private org public repos are displayed on "private" Signed-off-by: Andrew Thornton <art27@cantab.net> * switch from onlyPrivate to is_private Signed-off-by: Andrew Thornton <art27@cantab.net> * Generate swagger Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Ensure public repositories in private organizations are visible and fix ↵65432020-05-181-4/+25
| | | | | | | | | | | | | | | | | | | | admin organizations list (#11465) (#11474) * Ensure that we can see public repositories in private organization Fix #10144 (Again) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix Admin users and organizations page Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/repo_list.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Allow all members of private orgs to see public repos (#11442)zeripath2020-05-171-10/+15
| | | | | | | | | | | * Allow all members of private orgs to see public repos Fix #10144 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/repo_list.go Co-authored-by: Lauris BH <lauris@nix.lv>
* Refactor Cron and merge dashboard tasks (#10745)zeripath2020-05-165-52/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Cron and merge dashboard tasks * Merge Cron and Dashboard tasks * Make every cron task report a system notice on completion * Refactor the creation of these tasks * Ensure that execution counts of tasks is correct * Allow cron tasks to be started from the cron page * golangci-lint fixes * Enforce that only one task with the same name can be registered Signed-off-by: Andrew Thornton <art27@cantab.net> * fix name check Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k * as per @lafriks Signed-off-by: Andrew Thornton <art27@cantab.net> * Add git.CommandContext variants Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Make API EditIssue and EditPullRequest issue notifications (#11123)zeripath2020-05-171-16/+51
| | | | | | | | | | | | | | | | | | | | | | | * Make API EditIssue and EditPullRequest issue notifications Restructure models.UpdateIssueByAPI and EditIssue/EditPullRequest to issue notifications Fix #10014 Signed-off-by: Andrew Thornton <art27@cantab.net> * As per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * update status! Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add paging and archive/private repository filtering to dashboard list (#11321)zeripath2020-05-161-8/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add archived options to SearchRepository Signed-off-by: Andrew Thornton <art27@cantab.net> * Add only-private search Signed-off-by: Andrew Thornton <art27@cantab.net> * Add filter options and paging to dashboard repository page Signed-off-by: Andrew Thornton <art27@cantab.net> * swagger generate Signed-off-by: Andrew Thornton <art27@cantab.net> * fix-swagger-again Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @mrsdizzie also remember state Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use session for retrieving org teams (#11438)guillep2k2020-05-161-1/+1
| | | Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
* Fix issue ref migration (#11419)kolaente2020-05-151-0/+2
| | | | | | The migration introduced in #8742 breaks mysql installations. This pr fixes that by correctly using CONCAT. Signed-off-by: kolaente <k@knt.li>
* Fix ref links in issue overviews for tags (#8742)Sijmen Schoon2020-05-142-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Properly generate ref URLs Tags used to not generate correct URLs (src/branch/tags/1.0.0 instead of src/tags/1.0.0). Also cleans up some code around it with the created helper functions. * Fix formatting and create migration * Add copyright head to utils_test * Use a raw query for the ref migration * Remove semicolon * Quote column and table names in migration SQL * Change || to CONCAT, since MSSQL does not support || * Make migration engine aware * Add missing import * Move ref EndName and URL to the issue service * Fix tests * Add test for commit refs * Update issue.go * Use the right command for building JavaScript bundles * Prepare for merge * Check for refs/* before prepending in migration * Update services/issue/issue_test.go * Update modules/git/utils_test.go Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <matti@mdranta.net>
* Refactor Milestone related (#11225)65432020-05-122-304/+254
|
* Correctly set the organization num repos (#11339)zeripath2020-05-121-7/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Correctly set the organization num repos Correctly set the organization num repos to the number of accessible repos for the user Fix #11194 Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * attempt to fix mssql Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/user.go * Explicit columns Signed-off-by: Andrew Thornton <art27@cantab.net> * Add test and fix 0 counted orgs Signed-off-by: Andrew Thornton <art27@cantab.net> * remove orgname from api Signed-off-by: Andrew Thornton <art27@cantab.net>
* Changed image of openid-connect logo for better look on arc-green theme (#11312)Leo2020-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | * Set background of openIDConnect logo to white in arc-green theme * Fixed linting off arc-green theme Signed-off-by: Leo Maroni <git@em0lar.de> * Revert changes of first commit (white background) and replaced the image * Updated openid_connect (part 2) * Update public/img/auth/openid_connect.svg Now in one line Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix tracked time issues (#11349)65432020-05-091-4/+6
| | | | | | | | | * Fix nil exeption: #11313 * fix 500 * activate test 😆 * move logic
* Add EventSource support (#11235)zeripath2020-05-071-0/+15
| | | | | | If the browser supports EventSource switch to use this instead of polling notifications. Signed-off-by: Andrew Thornton art27@cantab.net
* Prevent multiple listings of organization when creating a repository (#11303)65432020-05-071-6/+6
| | | | | | | | | | | prevent double entries in results of GetOrgsCanCreateRepoByUserID I first try to only add GroupBy directly but xorm return broken user objects ... ... solution was to just query related UserIDs(OrgIDs) first and return OrgUsers based on this IDs close #11258 Co-authored-by: zeripath <art27@cantab.net>
* API: Add pull review endpoints (#11224)65432020-05-024-12/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * API: Added pull review read only endpoints * Update Structs, move Conversion, Refactor * refactor * lint & co * fix lint + refactor * add new Review state, rm unessesary, refacotr loadAttributes, convert patch to diff * add DeletePullReview * add paggination * draft1: Create & submit review * fix lint * fix lint * impruve test * DONT use GhostUser for loadReviewer * expose comments_count of a PullReview * infent GetCodeCommentsCount() * fixes * fix+impruve * some nits * Handle Ghosts :ghost: * add TEST for GET apis * complete TESTS * add HTMLURL to PullReview responce * code format as per @lafriks * update swagger definition * Update routers/api/v1/repo/pull_review.go Co-authored-by: David Svantesson <davidsvantesson@gmail.com> * add comments Co-authored-by: Thomas Berger <loki@lokis-chaos.de> Co-authored-by: David Svantesson <davidsvantesson@gmail.com>
* Fix spelling mistake with Rewiew (#11262)zeripath2020-04-301-4/+4
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Refactor UpdateOAuth2Application (#11034)65432020-04-301-10/+26
| | | | | Following on from #11008 refactor UpdateOAuth2Application
* Fix creation of Organization repos by Users with max created personal repos ↵Andrew Bezold2020-04-301-0/+1
| | | | | | | | | | | | | | | | | (#11183) * Fix creation of Org repos Fix go-gitea#9269 * Change variable name to appease linter * Update PR with suggestions Add a note for user.CanCreateRepo() about failure assumptions Change repo.create help message Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* [API] ListIssues add filter for milestones (#10148)65432020-04-306-13/+28
| | | | | | | | | * Refactor Issue Filter Func * ListIssues add filter for milestones * as per @lafriks * documentation ...
* BugFix: updateLabel can updated not allowed fields #11242 (#11242)65432020-04-283-9/+16
|
* make pagination optional for notifications (#10714)65432020-04-211-1/+5
|
* Add issue subscription check to API (#10967)65432020-04-212-0/+24
| | | | | | close #10962 Adds `GET /api/v1​/repos​/{owner}​/{repo}​/issues​/{index}​/subscriptions​/check` -> return a `WachInfo`
* Prevent xorm nil insert in Review.Comments (#11150)65432020-04-201-2/+4
|
* On Repo Deletion: Delete related TrackedTimes too (#11110)65432020-04-181-0/+5
|