Commit Graph

2118 Commits

Author SHA1 Message Date
zeripath fb5af37b3e
Add Close() method to gogitRepository (#8901) (#8958)
Backport #8901 - Adjusted slightly for 1.9

In investigating #7947 it has become clear that the storage component of go-git repositories needs closing.

This PR adds this Close function and adds the Close functions as necessary.

In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files.

Fixes #7947
2019-11-13 18:51:33 +00:00
David Svantesson b2c3a7d79f Fix deadline on update issue or PR via API (#8699) 2019-10-28 01:36:28 +02:00
Lunny Xiao 1bcbc02045 Revert "API should follow RequireSignInView (#8654) (#8661)" (#8674)
This reverts commit ffff835b73.
2019-10-24 22:07:13 +01:00
Monty Taylor 66ceee08dc Fix 500 when getting user as unauthenticated user (#8662)
When doing GET /api/v1/users/{user} as an unauthenticated user,
gitea throws a 500 because it's trying to dereference elements
from the context user. It wants to do this to see whether to
show the primary email and will do that if the logged in user
is admin or the user in question. However, if ctx.User is nil,
go gets really unhappy.
2019-10-24 16:25:30 +08:00
Lunny Xiao ffff835b73
API should follow RequireSignInView (#8654) (#8661) 2019-10-24 14:57:24 +08:00
Lunny Xiao 63c54f7e1f Hide some user information via API if user have no enough permission (#8655) (#8658)
* Hide some user information via API if user have no enough permission

* fix test
2019-10-24 09:01:40 +03:00
zeripath f9845454cf Use AppSubUrl for more redirections (#8647) (#8652)
Partial backport without changes to locale files.

Fix #8461 - fix misspelling of {{AppSubUrl}} and other misspelling in template
Fixes /explore and organisation redirection
2019-10-23 18:26:54 -04:00
zeripath c1152b15fe Add missed close in ServeBlobLFS (#8527) (#8543) 2019-10-17 00:05:23 +08:00
Lauris BH 05f6566786 Revert "[Backport] Fix issues/pr list broken when there are man… (#8425)
This reverts commit 0ea4b786cb.
2019-10-08 18:12:41 +02:00
6543 0ea4b786cb [Backport] Fix issues/pr list broken when there are many repositories (#8409) (#8418)
* Fix issues/pr list broken when there are many repositories (#8409)

* fix issues/pr list broken when there are many repositories

* remove unused codes

* fix counting error on issues/prs

* keep the old logic

* fix panic

* fix tests

* rm unused import
2019-10-08 14:35:00 +03:00
6543 aeec78543b Change general form binding to gogs form (#8334) (#8402) 2019-10-07 00:20:07 -04:00
6543 797194d2d0 Fix editor commit to new branch if PR disabled (#8375) (#8401) 2019-10-07 09:28:18 +08:00
guillep2k 5bac1a692a Allow users with explicit read access to give approvals (#8398) 2019-10-06 16:52:25 -04:00
David Svantesson 7156e2a71a Fix API for edit and delete release attachment (#8290)
* Add logging for when user requested attachment doesn't belong to the specified release.

* Fix API to use correct variable for release asset (attachment)
2019-09-26 21:16:47 +08:00
guillep2k 3fc42add16 Allow registration when button is hidden (#8238) 2019-09-19 11:58:47 +03:00
Lunny Xiao 267fbbf201
Fix team user api (#8172) (#8188)
* fix team user api

* fix tests

* fix api

* fix team user api

* change user convert

* fix tests

* fix tests
2019-09-17 11:23:40 +08:00
guillep2k b228d22736 Add reviewrs as participants (#8124) 2019-09-12 17:52:33 -04:00
guillep2k 5d2676089e Add change title notification for issues (#8064) 2019-09-03 11:39:53 +08:00
Tamal Saha 9bea8d825b Run CORS handler first for /api routes (#7967) (#8053)
Signed-off-by: Tamal Saha <tamal@appscode.com>
2019-09-02 08:55:33 +03:00
Gary Kim 4d6c8d9b13 backport: Fix adding default Telegram webhook (#7992)
Signed-off-by: Gary Kim <gary@garykim.dev>
2019-08-27 12:24:25 +08:00
Lunny Xiao 7dd726faeb upload support text/plain; charset=utf8 (#7899) 2019-08-17 13:59:36 +01:00
Lanre Adelowo 68424eddf0 fix non existent milestone with 500 error (#7867) (#7873) 2019-08-15 09:37:59 +08:00
zeripath 94f0151789 Attempt to fix hook problem (#7856) 2019-08-14 17:43:02 +08:00
Mario Lubenka 24fa56830f Enable switching to a different source branch when PR already exists (#7823)
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
2019-08-11 23:32:03 +03:00
David Svantesson 0fa9ea516a Rewrite existing repo units if setting is not included in api body (#7811)
Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
2019-08-11 12:45:45 +03:00
Antoine GIRARD 38e799779f api: fix multiple bugs with statuses endpoints (#7785) (#7807)
* fix commit statuses api url

* search refs before passing sha

* adjust tests

* directly search tags and branches names + remove un-needed check in NewCommitStatus

* fix comment

* de-duplicate code

* test: use relative setting.AppURL

* Update routers/api/v1/repo/status.go

Co-Authored-By: Lauris BH <lauris@nix.lv>

* remove return

* Update routers/api/v1/repo/status.go

Co-Authored-By: Lauris BH <lauris@nix.lv>
2019-08-09 16:18:46 +03:00
Lunny Xiao c6f1825fe9 add pagination for admin api get orgs and fix only list public orgs bug (#7742) (#7752) 2019-08-05 00:08:57 -04:00
Lunny Xiao d15e49f7ff improve branches list performance and fix protected branch icon when no-login (#7695) (#7704) 2019-08-01 11:40:00 -04:00
renothing d789170e31 fix wrong email when use gitea as OAuth2 provider (#7640) (#7647)
when you use gitea as OAuth2 provider, the /api/v1/user should return
user primary email as identifier, which is unique in OAuth2 clients.

this patch use convert.ToUser replace all u.APIFormat in api requests,
return primary email when caller is yourself or admin.
2019-07-27 17:25:16 +03:00
zeripath 5a3d9861ba Handle ErrUserProhibitLogin in http git (#7586, #7591) (#7590)
* Handle ErrUserProhibitLogin in http git (#7586)

* Use 403
2019-07-23 17:06:10 -04:00
Richard Mahn 103a66ae83 Fixes #7564 - Malformed URLs in API git/commits response (#7565) (#7567) 2019-07-22 22:38:38 +01:00
Richard Mahn 91e24a3a10 Fixes #7474 - Handles all redirects for Web UI File CRUD (#7478) (#7507)
* Fixes #7474 - Handles all redirects for Web UI File CRUD

* Fixes lint errors

* Typo fix

* Adds unit tests for a few helper functions

* Fixes per review

* Fix for new branch creation and to unit test

* Fixes the template used for errors on delete
2019-07-18 09:11:55 +08:00
Richard Mahn a29e667eff Backport for #7475 - settings error (#7483) 2019-07-16 12:45:38 +08:00
Gary Kim 2477737fff Only show "New Pull Request" button if repo allows pulls (#7426) (#7432)
Signed-off-by: Gary Kim <gary@garykim.dev>
2019-07-12 12:35:07 +08:00
Cherrg 1e585d7991 backport of #7385 - add missing template variable on organisation settings (#7386)
affects #6755

Signed-off-by: Michael Gnehr <michael@gnehr.de>
2019-07-08 21:03:44 +03:00
AJ ONeal 62d6127f1b Make captcha and password optional for external accounts (#6606) 2019-07-06 15:48:02 -04:00
leonklingele ef57fe4ae3 routers: do not leak secrets via timing side channel (#7364)
* routers: do not leak secrets via timing side channel

* routers/repo: do not leak secrets via timing side channel
2019-07-06 13:03:13 -04:00
leonklingele 96b66e330b routers/user: ensure that decryption of cookie actually suceeds (#7363)
Previously, only the first return value of ctx.GetSuperSecureCookie
was used to check whether decryption of the auth cookie succeeded.
ctx.GetSuperSecureCookie also returns a second value, a boolean,
indicating success or not. That value should be checked first to
be on the safe side and not rely on internal logic of the encryption
and decryption blackbox.
2019-07-06 23:47:09 +08:00
Lunny Xiao b5aa7f7ceb fix api route (#7346) 2019-07-03 06:31:29 +01:00
zeripath 3563650bdb #6946 Run hooks on merge/edit and cope with protected branches (#6961)
* Fix #6946 by checking PullRequest ID on pushing

* Ensure we have the owner name, the pr attributes and the the issue

* Fix TestSearchRepo by waiting till indexing is done

* Update integrations/repo_search_test.go

* changes as per @mrsdizzie

* missing comma

* Spelling mistake

* Fix full pushing environment
2019-07-01 09:18:13 +08:00
Lunny Xiao ff85dd3e12 Add commit statuses reports on pull request view (#6845)
* Add commit statuses reports on pull view

* Add some translations

* improve the UI

* fix fmt

* fix tests

* add a new test git repo to fix tests

* fix bug when headRepo or headBranch missing

* fix tests

* fix tests

* fix consistency

* fix tests

* fix tests

* change the test repo

* fix tests

* fix tests

* fix migration

* keep db size consistency

* fix translation

* change commit hash status table unique index

* remove unused table

* use char instead varchar

* make hashCommitStatusContext private

* split merge section with status check on pull view ui

* fix tests; fix arc-green theme on pull ui
2019-06-30 08:57:59 +01:00
Richard Mahn cd96dee982 Fixes #7292 - API File Contents bug (#7301) 2019-06-29 16:51:10 -04:00
Richard Mahn 002b597c1f Fixes #7152 - Allow create/update/delete message to be empty, use default message (#7324)
* Fixes #7152 - Allow create/update/delete message to be empty, use default message

* Linting fix

* Fix to delete integration tests
2019-06-29 16:19:24 +01:00
Richard Mahn 567e117df8 Fixes #7238 - Annotated tag commit ID incorrect (#7321)
* Fixes #7238 - Annotated tag commit ID incorrect

* Fixes #7238 - Annotated tag commit ID incorrect
2019-06-29 11:44:17 +01:00
Mario Lubenka 7c0f2b9843 Show Pull Request button or status of latest PR in branch list (#6990)
* Show Pull Request button or status of latest PR in branch list

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Do not show pull request button on deleted branches

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Do not show commit divergence on deleted branches

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Use XORMs Get instead of limit

* Links pull request ID and use smaller labels for displaying the pull request status

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Handle error when getting latest pull request

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Indent template

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Check error when loading issue

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
2019-06-27 22:15:30 +08:00
Lunny Xiao edc94c7041 Monitor all git commands; move blame to git package and replace git as a variable (#6864)
* monitor all git commands; move blame to git package and replace git as a variable

* use git command but not other commands

* fix build

* move exec.Command to git.NewCommand

* fix fmt

* remove unrelated changes

* remove unrelated changes

* refactor IsEmpty and add tests

* fix tests

* fix tests

* fix tests

* fix tests

* remove gitLogger

* fix fmt

* fix isEmpty

* fix lint

* fix tests
2019-06-26 14:15:26 -04:00
Lunny Xiao 161e12e157
Shadow the password on cache and session config on admin panel (#7300)
* shadow the password on cache and session config on admin panel

* add shadow password of mysql/postgres/couchbase

* fix log import
2019-06-27 00:12:38 +08:00
Lunny Xiao aa7c34cf86 Fix error log when loading issues caused by a xorm bug (#7271)
* fix error log when loading issues caused by a xorm bug

* upgrade packages

* fix fmt

* fix Consistency

* fix tests
2019-06-23 18:22:43 +03:00
zeripath baefea311f
Fix #732: Add LFS objects to base repository on merging (#7082)
On merge we walk the merge history and ensure that all lfs objects pointed to in
the history are added to the base repository. This switches from relying on having git-lfs installed on the server, (and in fact .gitattributes being correctly installed.)
2019-06-22 18:35:34 +01:00
Lunny Xiao 8ec659722d Only check and config git on web subcommand but not others (#7236)
* only check and config git on web subcommand but not others

* add Init in git tests
2019-06-19 19:53:37 +03:00