Commit Graph
2715 Commits
Author SHA1 Message Date
zeripathandGitHub 6abb8d751c Invalidate comments when file is shortened (#11882) (#11884)
Backport #11882

Fix #10686

Signed-off-by: Andrew Thornton <[email protected]>
2020-06-15 13:26:30 -04:00
Cirno the StrongestandGitHub fdc6287973 Rework api/user/repos for pagination (#11827) (#11877)
* 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 <[email protected]>
(cherry picked from commit 0159851cc3)
2020-06-13 18:35:13 +01:00
zeripathandGitHub f2bde40804 Add doctor check to set IsArchived false if it is null (partial backport #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 <[email protected]>
2020-06-11 17:08:13 -04:00
Cirno the StrongestandGitHub 56660c3fd0 Use DEFAULT_PAGING_NUM instead of MAX_RESPONSE_ITEMS in ListOptions (#11831) (#11836)
Co-authored-by: techknowlogick <[email protected]>
(cherry picked from commit 2b2b3e4c37)
2020-06-10 13:42:10 -04:00
a076cb2a4c Increase maximum SQLite variables count to 32766 (#11696) (#11783)
* Increase maximum SQLite variables count to 32766 (#11696)

per https://www.sqlite.org/limits.html

Co-authored-by: techknowlogick <[email protected]>
(cherry picked from commit a5aa5c58c1)

* Fix missing CGO_EXTRA_FLAGS build arg for docker

Co-authored-by: techknowlogick <[email protected]>
2020-06-07 00:04:00 -04:00
zeripathandGitHub 7dd9506d06 Fix verification of subkeys of default gpg key (#11713) (#11747)
* Fix verification of subkeys of default gpg key

Fix #10309

Signed-off-by: Andrew Thornton <[email protected]>

* Remove debug log

* Update models/gpg_key.go

* As per @6543

Signed-off-by: Andrew Thornton <[email protected]>
2020-06-03 18:01:32 +01:00
a34826b19f Change language statistics to save size instead of percentage (#11681) (#11690)
* 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 <[email protected]>

* Do not exclude if only language

* Fix edge cases with special langauges

Co-authored-by: Cirno the Strongest <[email protected]>

* 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 <[email protected]>
2020-06-02 20:55:21 +03:00
zeripathandGitHub d78c31c216 Add logging to long migrations (#11647) (#11691)
* Add logging to long migrations

Also fix v136 to not use models

Signed-off-by: Andrew Thornton <[email protected]>
2020-05-30 21:44:14 -04:00
d9db28a25a Doctor check & fix db consistency (#11111) (#11676)
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 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>

Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2020-05-29 13:00:43 -05:00
6543andGitHub 762c0463f4 Handle expected errors in AddGPGkey API (#11644) (#11661)
* handle GPG Parse & Email Errors

* correct TEST

* update Swagger

* more Docu
2020-05-28 18:16:41 -04:00
eb5ea5f67a Fix wrong milestone in webhook message (#11596) (#11611)
Backport of #11596

Signed-off-by: Gary Kim <[email protected]>

Co-authored-by: zeripath <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-05-25 01:01:49 -04:00
zeripathandGitHub a777f8ae75 Allow different HardBreaks settings for documents and comments (#11515) (#11599)
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 [email protected]

Changes to index.js as per @silverwind 
Co-authored-by: silverwind <[email protected]>

Changes to docs as per @guillep2k 
Co-authored-by: guillep2k <[email protected]>
2020-05-24 11:45:56 +01:00
8525a48581 Fix repo-list private and total count bugs (#11500) (#11532)
* Fix repo-list private and total count bugs

Signed-off-by: Andrew Thornton <[email protected]>

* Ensure limited and private org public repos are displayed on "private"

Signed-off-by: Andrew Thornton <[email protected]>

* switch from onlyPrivate to is_private

Signed-off-by: Andrew Thornton <[email protected]>

* Generate swagger

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: guillep2k <[email protected]>

Co-authored-by: guillep2k <[email protected]>
2020-05-21 08:23:20 -05:00
087719cb8d Ensure public repositories in private organizations are visible and fix admin organizations list (#11465) (#11474)
* Ensure that we can see public repositories in private organization

Fix #10144 (Again)

Signed-off-by: Andrew Thornton <[email protected]>

* Fix Admin users and organizations page

Signed-off-by: Andrew Thornton <[email protected]>

* Update models/repo_list.go

Co-authored-by: Lauris BH <[email protected]>

Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2020-05-18 07:21:00 +01:00
c642cd0676 Allow all members of private orgs to see public repos (#11442)
* Allow all members of private orgs to see public repos

Fix #10144

Signed-off-by: Andrew Thornton <[email protected]>

* Update models/repo_list.go

Co-authored-by: Lauris BH <[email protected]>
2020-05-17 16:22:17 +08:00
9a2e47b23a Refactor Cron and merge dashboard tasks (#10745)
* 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 <[email protected]>

* fix name check

Signed-off-by: Andrew Thornton <[email protected]>

* as per @guillep2k

* as per @lafriks

Signed-off-by: Andrew Thornton <[email protected]>

* Add git.CommandContext variants

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-05-16 19:31:38 -04:00
414c9ee76a Make API EditIssue and EditPullRequest issue notifications (#11123)
* Make API EditIssue and EditPullRequest issue notifications

Restructure models.UpdateIssueByAPI and EditIssue/EditPullRequest
to issue notifications

Fix #10014

Signed-off-by: Andrew Thornton <[email protected]>

* As per @6543

Signed-off-by: Andrew Thornton <[email protected]>

* update status!

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: John Olheiser <[email protected]>
Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2020-05-17 00:05:19 +03:00
c86bc8e061 Add paging and archive/private repository filtering to dashboard list (#11321)
* Add archived options to SearchRepository

Signed-off-by: Andrew Thornton <[email protected]>

* Add only-private search

Signed-off-by: Andrew Thornton <[email protected]>

* Add filter options and paging to dashboard repository page

Signed-off-by: Andrew Thornton <[email protected]>

* swagger generate

Signed-off-by: Andrew Thornton <[email protected]>

* fix-swagger-again

Signed-off-by: Andrew Thornton <[email protected]>

* as per @mrsdizzie also remember state

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
2020-05-16 23:07:01 +03:00
c3d9a5f846 Use session for retrieving org teams (#11438)
Co-authored-by: Guillermo Prandi <[email protected]>
2020-05-16 20:29:29 +01:00
kolaenteandGitHub 57217cabe3 Fix issue ref migration (#11419)
The migration introduced in #8742 breaks mysql installations. This pr fixes that by correctly using CONCAT.

Signed-off-by: kolaente <[email protected]>
2020-05-15 15:05:18 +01:00
66a9ef9036 Fix ref links in issue overviews for tags (#8742)
* 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 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-05-14 18:55:43 -04:00
6543andGitHub 7257c39ddf Refactor Milestone related (#11225) 2020-05-12 22:54:35 +01:00
zeripathandGitHub c42c31a111 Correctly set the organization num repos (#11339)
* 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 <[email protected]>

* as per @lunny

Signed-off-by: Andrew Thornton <[email protected]>

* attempt to fix mssql

Signed-off-by: Andrew Thornton <[email protected]>

* Update models/user.go

* Explicit columns

Signed-off-by: Andrew Thornton <[email protected]>

* Add test and fix 0 counted orgs

Signed-off-by: Andrew Thornton <[email protected]>

* remove orgname from api

Signed-off-by: Andrew Thornton <[email protected]>
2020-05-12 01:04:08 +03:00
da5e3fa299 Changed image of openid-connect logo for better look on arc-green theme (#11312)
* Set background of openIDConnect logo to white in arc-green theme

* Fixed linting off arc-green theme

Signed-off-by: Leo Maroni <[email protected]>

* 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 <[email protected]>

Co-authored-by: silverwind <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2020-05-10 17:55:22 +03:00
6543andGitHub cd4f7ba5bf Fix tracked time issues (#11349)
* Fix nil exeption: #11313

* fix 500

* activate test 😆

* move logic
2020-05-09 11:18:44 -03:00
zeripathandGitHub 791353c03b Add EventSource support (#11235)
If the browser supports EventSource switch to use this instead of
polling notifications.

Signed-off-by: Andrew Thornton [email protected]
2020-05-07 22:49:00 +01:00
507d0ec57a Prevent multiple listings of organization when creating a repository (#11303)
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 <[email protected]>
2020-05-07 14:24:59 +01:00
c97494a4f4 API: Add pull review endpoints (#11224)
* 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 👻

* 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 <[email protected]>

* add comments

Co-authored-by: Thomas Berger <[email protected]>
Co-authored-by: David Svantesson <[email protected]>
2020-05-02 03:20:51 +03:00
zeripathandGitHub 4974b7c120 Fix spelling mistake with Rewiew (#11262)
Signed-off-by: Andrew Thornton <[email protected]>
2020-04-30 21:24:08 +01:00
6543andGitHub ab69b9b1a6 Refactor UpdateOAuth2Application (#11034)
Following on from #11008 refactor UpdateOAuth2Application
2020-04-30 18:50:47 +01:00
3dc6af3d70 Fix creation of Organization repos by Users with max created personal repos (#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 <[email protected]>
2020-04-30 16:11:56 +01:00
6543andGitHub bfda0f3864 [API] ListIssues add filter for milestones (#10148)
* Refactor Issue Filter Func

* ListIssues add filter for milestones

* as per @lafriks

* documentation ...
2020-04-30 01:15:39 -03:00
6543andGitHub 6b6f20b6d4 BugFix: updateLabel can updated not allowed fields #11242 (#11242) 2020-04-28 19:28:56 -04:00
6543andGitHub 49f8b20570 make pagination optional for notifications (#10714) 2020-04-21 22:21:46 +01:00
6543andGitHub bb4261a5ed Add issue subscription check to API (#10967)
close #10962

Adds `GET /api/v1​/repos​/{owner}​/{repo}​/issues​/{index}​/subscriptions​/check`
 -> return a `WachInfo`
2020-04-21 14:48:53 +01:00
6543andGitHub 77171abcad Prevent xorm nil insert in Review.Comments (#11150) 2020-04-20 04:04:08 +01:00
6543andGitHub 4be7cf0405 On Repo Deletion: Delete related TrackedTimes too (#11110) 2020-04-18 22:39:23 +01:00
silverwindandGitHub 5180deb819 Send 404 immediately for known public requests (#11117)
Instead of further handling requests to public which causes issues like #11088, immediately terminate requests to directories js, css, fomantic if no file is found which is checked against a hardcoded list. Maybe there is a way to retrieve the top-level entries below public in a dynamic fashion.

I also added fomantic to the reserved usernames and sorted the list.

Fixes: #11088
2020-04-18 22:01:06 +01:00
4f597b1866 Add single release page and latest redirect (#11102)
* Add single release and latest release routes

Signed-off-by: jolheiser <[email protected]>

* Update API and move latest search to models

Signed-off-by: jolheiser <[email protected]>

* Fix swagger

Signed-off-by: jolheiser <[email protected]>

Co-authored-by: guillep2k <[email protected]>
2020-04-18 11:47:15 -03:00
1b86f174ce Add a way to mark Conversation (code comment) resolved (#11037)
* Add a way to mark Conversation (code comment) resolved

mark Conversation is a way to mark a Conversation is stale
or be solved. when it's marked as stale, will be hided like
stale. all Pull Request writer , Offical Reviewers and poster
can add or remove Conversation resolved mark.

Signed-off-by: a1012112796 <[email protected]>

* fix lint

* Apply suggestions from code review

* Add ResolveDoer
* fix ui

Co-Authored-By: Lauris BH <[email protected]>
Co-Authored-By: 6543 <[email protected]>

* change IsResolved to an function
Add permission check in UpdateResolveConversation

* Apply suggestions from code review

* change return error for permisson check
* add default message for deleted user
* get issue message from comment
* add migration for ``ResolveDoerID`` column

another  change:
* block mark pending review as resolved because it's not necessary

Co-authored-by: guillep2k <[email protected]>

* change button color

* resolve button size

* fix code style

* remove unusefull code

Co-authored-by: guillep2k <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: guillep2k <[email protected]>
2020-04-18 10:50:25 -03:00
12960b9d18 [BugFix] remove nil inserts in models (#11096)
* Fix InsertReleases Nil Insert on Attachments

* FIX "No element on slice when insert" & smal refactor

* again

* impruve

* rm useles newline

* Apply suggestions from code review

Co-Authored-By: zeripath <[email protected]>

* process insert as a whole

Co-authored-by: zeripath <[email protected]>
2020-04-17 20:42:57 +03:00
c52d48aae4 Prevent merge of outdated PRs on protected branches (#11012)
* Block PR on Outdated Branch

* finalize

* cleanup

* fix typo and sentences

thanks @guillep2k

Co-Authored-By: guillep2k <[email protected]>

Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2020-04-16 22:00:36 -03:00
6543andGitHub a4cab2bbfa [BugFix] ReviewCount: GetApprovalCounts func sorted wrong (#11086)
* FIX by simplify

* code reformat and optimize
2020-04-16 13:44:34 +03:00
Lauris BHandGitHub 4dc62dadce Migrate to go-enry new version (#10906) 2020-04-15 20:40:39 +03:00
6543andGitHub d66b9a4690 Fix Migration 136 (be less aggressive to open pulls missing git files) (#11072)
* be less aggressife to open pulls when migrating

* remove unused
2020-04-14 17:16:07 -05:00
6543andGitHub 10e2f29144 Cache PullRequest Divergence (#10914)
* Cache PullRequest Divergence

* only re-calc divergence if AddTestPullRequestTask() is exec

* migrate already open pulls

* finalize

* take care of closed&not-merged+deleted-branch pull requests

* fix nil pointer exeption

Signed-off-by: 6543 <[email protected]>

* try this

* no error its a warn

* init gitea-repositories-meta

* dont use gitDivergence type

* CI.restart()

* CI.restart()

* CI.restart()

* CI.restart()

* check IsUserAllowedToUpdate independend from CommitsBehind
2020-04-14 09:53:34 -04:00
281029529b ui: Add MergePull comment type instead of close for merge PR (#11058)
Signed-off-by: a1012112796 <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
2020-04-14 09:06:23 +08:00
ad5c43ae5d Reject duplicate AccessToken names (#10994)
* make sure duplicate token names cannot be used

* add check to api routes too

* add @lunny s suggestion

* fix & don't forget User.ID

* AccessTokenByNameExists() return error too

* unique token for each test

* fix lint

Signed-off-by: 6543 <[email protected]>

Co-authored-by: Lanre Adelowo <[email protected]>
2020-04-13 22:02:48 +03:00
cc07b9ca37 Fix CreateComment for SQLite and JS click event on Request Review (#11040)
* fix some bug about Request review

* fix ``CreateComment`` wrong using ,it will not work when use Sqlite
* fix wrong js click event code , it will send wrong data when it has
many choices

Signed-off-by: a1012112796 <[email protected]>

* Apply suggestions from code review

Co-Authored-By: Lauris BH <[email protected]>

* add getReviewerByIssueIDAndUserID
fix wrong conditions check in initIssueComments after #10972

* call CI again

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: guillep2k <[email protected]>
2020-04-11 01:44:50 -03:00
6543andGitHub bc362ea3c6 remove package code.gitea.io/gitea/modules/git import out of models (#11025) 2020-04-10 14:26:37 +03:00