Commit Graph
2164 Commits
Author SHA1 Message Date
bcb722daec Make CertFile and KeyFile relative to CustomPath (#9868) (#9874)
* Make CertFile and KeyFile relative to CustomPath

The current code will absolute CertFile and KeyFile against the current working directory. This is quite unexpected for users. This code makes relative paths absolute against the CustomPath.

Fix #4196

* Improve error reporting when reading certificates

* Apply suggestions from code review

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

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

Co-authored-by: guillep2k <[email protected]>
2020-01-19 19:59:30 +00:00
Lunny Xiaoandtechknowlogick 8add1dfacc Fix issues/pulls dependencies problems (#9842) (#9864)
* Fix issues/pulls dependencies problems

* fix swagger and api param name

* fix js
2020-01-19 12:56:57 -05:00
Moritzandtechknowlogick b577500a54 Fix markdown anchor links (#9673) (#9840) 2020-01-17 11:49:50 -05:00
zeripathandAntoine GIRARD dbe6136348 Fix missing unlock in uniquequeue (#9791) 2020-01-16 01:09:31 +01:00
602c5da953 Fix #9752 (#9769) (#9775)
Co-authored-by: zeripath <[email protected]>
2020-01-15 01:41:28 +01:00
Lunny XiaoandAntoine GIRARD 28508792ba Fix missing updated time on migrated issues and comments (#9744) (#9764)
* Fix missing updated time on migrated issues and comments

* Fix testing and missing updated on migrating pullrequest

Co-authored-by: Antoine GIRARD <[email protected]>

Co-authored-by: Antoine GIRARD <[email protected]>
2020-01-14 17:55:03 +01:00
4072f28e60 Make hook status printing configurable with delay (#9641) (#9725)
* Delay printing hook statuses until after 1 second

* Move to a 5s delay, wrapped writer structure and add config

* Update cmd/hook.go

* Apply suggestions from code review

* Update cmd/hook.go

Co-authored-by: Antoine GIRARD <[email protected]>

Co-authored-by: Antoine GIRARD <[email protected]>
2020-01-12 18:02:36 +00:00
zeripathandGitHub f8ea50cc7a Remove unused lock (#9710) 2020-01-11 19:06:39 +00:00
zeripathandGitHub 0e53a16cca Missed q.lock.Unlock() will cause panic (#9706) 2020-01-11 17:05:24 +00:00
guillep2kandtechknowlogick ff16099c6d Don't attempt to close issue if already closed (#9699) 2020-01-11 01:42:11 -05:00
zeripathandtechknowlogick 3a00a690c9 Prevent redirect to Host (#9678) (#9679) 2020-01-09 16:37:37 -05:00
John OlheiserandLauris BH 04a77b1f42 Add HTML URL to API Issues (#9654) (#9661)
* Add HTML URL to API Issues

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

* Swagger

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

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

Co-authored-by: Lauris BH <[email protected]>
2020-01-09 08:07:21 +02:00
f523372d07 Add PR review webhook to Telegram (#9653) (#9655)
Signed-off-by: jolheiser <[email protected]>

Co-authored-by: Antoine GIRARD <[email protected]>

Co-authored-by: Antoine GIRARD <[email protected]>
2020-01-08 21:42:28 +02:00
6543andAntoine GIRARD e39c238ef4 fix #9648 (#9652) 2020-01-08 17:32:25 +01:00
62eb1b0f25 Graceful Queues: Issue Indexing and Tasks (#9363)
* Queue: Add generic graceful queues with settings

* Queue & Setting: Add worker pool implementation

* Queue: Add worker settings

* Queue: Make resizing worker pools

* Queue: Add name variable to queues

* Queue: Add monitoring

* Queue: Improve logging

* Issues: Gracefulise the issues indexer

Remove the old now unused specific queues

* Task: Move to generic queue and gracefulise

* Issues: Standardise the issues indexer queue settings

* Fix test

* Queue: Allow Redis to connect to unix

* Prevent deadlock during early shutdown of issue indexer

* Add MaxWorker settings to queues

* Merge branch 'master' into graceful-queues

* Update modules/indexer/issues/indexer.go

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

* Update modules/indexer/issues/indexer.go

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

* Update modules/queue/queue_channel.go

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

* Update modules/queue/queue_disk.go

* Update modules/queue/queue_disk_channel.go

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

* Rename queue.Description to queue.ManagedQueue as per @guillep2k

* Cancel pool workers when removed

* Remove dependency on queue from setting

* Update modules/queue/queue_redis.go

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

* As per @guillep2k add mutex locks on shutdown/terminate

* move unlocking out of setInternal

* Add warning if number of workers < 0

* Small changes as per @guillep2k

* No redis host specified not found

* Clean up documentation for queues

* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

* Update modules/indexer/issues/indexer_test.go

* Ensure that persistable channel queue is added to manager

* Rename QUEUE_NAME REDIS_QUEUE_NAME

* Revert "Rename QUEUE_NAME REDIS_QUEUE_NAME"

This reverts commit 1f83b4fc9b.

Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2020-01-07 12:23:09 +01:00
Timon EngelkeandAntoine GIRARD abc0f53539 Add a /user/login landing page option (#9622)
* Add a /user/login landing page option

* Add test case for login landing page
2020-01-06 17:50:44 +01:00
John Olheiserandzeripath fb3a6aba7d Only show sender if it makes sense (#9601)
Signed-off-by: jolheiser <[email protected]>
2020-01-04 22:20:15 +00:00
ea707f5a77 Add branch protection option to block merge on requested changes. (#9592)
* Add branch protection option to block merge on requested changes.

* Add migration step

* Fix check to correct negation

* Apply suggestions from code review

Language improvement.

Co-Authored-By: John Olheiser <[email protected]>

* Copyright year.

Co-authored-by: John Olheiser <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2020-01-03 19:47:09 +02:00
mrsdizzieandLauris BH b39fab41c8 Some more e-mail notification fixes (#9596)
* Some more e-mail notification fixes

A few more small e-mail notification fixes/changes

* Style footer of notification email to be smaller
* Include text for when pull request is merged
* Don't include original body of issue or PR when merging/closing by
setting issue.Content to "" in these cases

* Set Re: prefix and meessage-ID headers based on actName instead of checking for a
comment. This fixes a bug where certain actions that didn't have a
comment were setting Message-ID instead of In-Reply-To which caused some
mail programs not to show those messages as they would have had the same
Message-ID as a previous message. Also fixes the case where a final
comment and closing message would have been displayed out of order if
you didn't have a copy of the original issue/pr cretion message.

* Update other template footers for consistency
2020-01-03 19:13:22 +02:00
9600c27085 [API] Fix 9544 | return 200 when reaction already exist (#9550)
* add ErrReactionAlreadyExist

* extend CreateReaction

* reaction already exist = 200

* extend FindReactionsOptions

* refactor swagger options/definitions

* fix swagger-validate

* Update models/error.go

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

* fix test PART1

* extend FindReactionsOptions with UserID option

* catch error on test

* fix test PART2

* format ...

Co-authored-by: zeripath <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2019-12-31 03:21:21 -05:00
6543andLunny Xiao 655aea13a5 update swagger info (#9558) 2019-12-31 12:11:15 +08:00
zeripathandLauris BH 27757714d0 Change markdown rendering from blackfriday to goldmark (#9533)
* Move to goldmark

Markdown rendering moved from blackfriday to the goldmark.

Multiple subtle changes required to the goldmark extensions to keep
current rendering and defaults.

Can go further with goldmark linkify and have this work within markdown
rendering making the link processor unnecessary.

Need to think about how to go about allowing extensions - at present it
seems that these would be hard to do without recompilation.

* linter fixes

Co-authored-by: Lauris BH <[email protected]>
2019-12-31 03:53:28 +02:00
0c07f1de5b Provide Default messages for merges (#9393)
Co-Authored-By: guillep2k <[email protected]>
2019-12-30 18:34:11 -05:00
Lunny Xiaoandzeripath ed67bbe444 Fix repository issues pagination bug when there are more than one label filter (#9512) 2019-12-28 14:43:46 +00:00
81e63d0714 Refactor webhooks to reduce code duplication (#9422)
* Start webhook refactoring to reduce code duplication

* More webhook refactoring

* Unify webhook release messages

* Fix webhook release link

* Remove sql import

* More webhook refactoring

* More webhook refactoring

* Webhook tests extended

* Fixed issue opened webhook

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2019-12-28 08:55:09 +00:00
zeripathandLunny Xiao 55cd33e124 Stop various tests from adding to the source tree (#9515)
Instead of just adding test generated files to .gitignore prevent
them from being produced in the first place.

Co-authored-by: Lunny Xiao <[email protected]>
2019-12-28 10:08:05 +08:00
4ee97465e9 [Fix] AllowedReaction code (#9518)
* optimize

* CI.restart()

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: zeripath <[email protected]>
2019-12-27 18:43:56 -05:00
6543andzeripath f2d03cda96 [API] Extend times API (#9200)
Extensively extend the times API.

close #8833; close #8513; close #8559
2019-12-27 20:30:58 +00:00
Lunny Xiaoandzeripath 0bcf644da4 Fix deleted branch isn't removed when push the branch again (#9516) 2019-12-27 19:17:37 +00:00
7bfb83e064 Batch hook pre- and post-receive calls (#8602)
* make notifyWatchers work on multiple actions

* more efficient multiple notifyWatchers

* Make CommitRepoAction take advantage of multiple actions

* Batch post and pre-receive results

* Set batch to 30

* Auto adjust timeout & add logging

* adjust processing message

* Add some messages to pre-receive

* Make any non-200 status code from pre-receive an error

* Add missing hookPrintResults

* Remove shortcut for single action

* mistaken merge fix

* oops

* Move master branch to the front

* If repo was empty and the master branch is pushed ensure that that is set as the default branch

* fixup

* fixup

* Missed HookOptions in setdefaultbranch

* Batch PushUpdateAddTag and PushUpdateDelTag

Co-authored-by: Lunny Xiao <[email protected]>
2019-12-26 13:29:45 +02:00
Lunny XiaoandGitHub 8b2f29c0d2 fix datarace on issue indexer queue (#9490) 2019-12-25 17:44:09 +08:00
30181d459d Wrap the code indexer (#9476)
* Wrap the code indexer

In order to prevent a data race in the code indexer it must be wrapped
with a holder otherwise it is possible to Search/Index on an
incompletely initialised indexer, and search will fail with a nil
pointer until the repository indexer is initialised.

Further a completely initialised repository indexer should not be closed
until Termination otherwise actions in Hammer/Shutdown phases could
block or be lost.

Finally, there is a complex dance of shutdown etiquette should the index
initialisation fail. This PR restores that.

* Always return err if closed whilst waiting

Co-authored-by: techknowlogick <[email protected]>
2019-12-24 15:26:34 +08:00
40e99ea010 [API] Extend contents with dates (#9464)
* extend CommitTree func

* make sure Date NOT nil

* spell corection

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

* add TEST

Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2019-12-24 10:33:52 +08:00
zeripathandGitHub 017f314b5a Use Req.URL.RequestURI() to cope with FCGI urls (#9473)
* Use Req.URL.RequestURI() to cope with FCGI urls

* Add debug logging statement when forbidden in internal API.
2019-12-24 00:11:12 +00:00
John Olheiserandzeripath e6ceb6880a Prefix all user-generated IDs in markup (#9477)
* Prefix all user-generated IDs in markup
* Add user-content- to IDs in unit-tests
* fixup markdown_test.go
* update the hrefs for the wiki test
* Add blackfriday extension regex

Signed-off-by: jolheiser <[email protected]>
2019-12-23 22:38:50 +00:00
Lunny XiaoandGitHub 89b4e0477b Refactor code indexer (#9313)
* Refactor code indexer

* fix test

* fix test

* refactor code indexer

* fix import

* improve code

* fix typo

* fix test and make code clean

* fix lint
2019-12-23 20:31:16 +08:00
mrsdizzieandAntoine GIRARD 2f9564f993 Set default ssh.minimum_key_sizes (#9466)
The minimum key size defaults weren't set as suggested in app.ini.sample
so if you enabled MINIMUM_KEY_SIZE_CHECK it would always fail since
there would be no matching values to check against. This pr adds the
default values that should have been there.

Should fix #9465
2019-12-22 23:46:35 +01:00
1df701fd1a Add ActionCommentPull action (#9456)
* Add ActionCommentPull action

Adds ActionCommentPull action to distinguish between a comment on an
issue and on a pull request

* Update modules/notification/action/action.go

Co-authored-by: Lunny Xiao <[email protected]>
2019-12-22 08:29:26 +00:00
Brad Albrightandzeripath 875d6b2f8e fixed bug in GitTreeBySHA where pulling items from a page other than page 1 would fail because the wrong var was used to set the entries to return (#9459) 2019-12-22 00:16:21 +00:00
guillep2kandzeripath 4f42e03a35 Fix wrong notification on merge (#9450) 2019-12-20 22:31:05 +00:00
6543andLauris BH 2848c5eb8f Swagger info corrections (#9441)
* use numbers and not http.Status___ enum

* fix test

* add many missing swagger responses

* code format

* Deletion Sould return 204 ...

* error handling improvements

* if special error type ... then add it to swagger too

* one smal nit

* invalidTopicsError is []string

* valid swagger specification 2.0
 - if you add responses swagger can tell you if you do it right 👍

* use ctx.InternalServerError

* Revert "use numbers and not http.Status___ enum"

This reverts commit b1ff386e24.

* use http.Status* enum everywhere
2019-12-20 19:07:12 +02:00
mrsdizzieandtechknowlogick d644934956 Use OriginalURL insead of CloneAddr in migration logging (#9418)
CloneAddr will contain username and password credentials and they will
get stored in system notices about failed migrations (and logs if trace
is set). Replace with OriginalURL that doesn't have those.
2019-12-18 16:49:56 -05:00
Lauris BHandAntoine GIRARD 8a208e4349 Remove unsued struct (#9405) 2019-12-18 13:10:40 +01:00
CornelandLauris BH 04ab1138f6 Fix Slack webhook payload title generation to work with Mattermost (#9378)
* Fix Slack webhook payload title generation to work with Mattermost by using a markdown link instead of html

* Fix Slack webhook attachment title and title link handling
2019-12-18 12:01:00 +02:00
Lunny Xiaoandtechknowlogick ffc904b1e0 Sleep longer if request speed is over github limitation (#9335)
* Sleep longer if request speed is over github limitation

* improve code

* remove unused code

* fix lint

* Use github's rate limit remain value to determine how long to sleep

* Save reset time when finished github api request

* fix bug

* fix lint

* Add context.Context for sleep

* fix test

* improve code

* fix bug and lint

* fix import order
2019-12-16 23:16:54 -05:00
zeripathandtechknowlogick d1a49977b0 AuthorizedKeysCommand should not query db directly (#9371)
* AuthorizedKeysCommand should not query db directly

* Update routers/private/internal.go

* Fix import order
2019-12-16 20:49:07 -05:00
John OlheiserandLunny Xiao 1707f59966 Remove text from action-only webhooks (#9377)
* Remove text from contextual webhooks

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

* Missed one in Telegram

Signed-off-by: jolheiser <[email protected]>
2019-12-17 08:28:19 +08:00
Mario LubenkaandLunny Xiao 61db834904 Change target branch for pull request (#6488)
* Adds functionality to change target branch of created pull requests

Signed-off-by: Mario Lubenka <[email protected]>

* Use const instead of var in JavaScript additions

Signed-off-by: Mario Lubenka <[email protected]>

* Check if branches are equal and if PR already exists before changing target branch

Signed-off-by: Mario Lubenka <[email protected]>

* Make sure to check all commits

Signed-off-by: Mario Lubenka <[email protected]>

* Print error messages for user as error flash message

Signed-off-by: Mario Lubenka <[email protected]>

* Disallow changing target branch of closed or merged pull requests

Signed-off-by: Mario Lubenka <[email protected]>

* Resolve conflicts after merge of upstream/master

Signed-off-by: Mario Lubenka <[email protected]>

* Change order of branch select fields

Signed-off-by: Mario Lubenka <[email protected]>

* Removes duplicate check

Signed-off-by: Mario Lubenka <[email protected]>

* Use ctx.Tr for translations

Signed-off-by: Mario Lubenka <[email protected]>

* Recompile JS

Signed-off-by: Mario Lubenka <[email protected]>

* Use correct translation namespace

Signed-off-by: Mario Lubenka <[email protected]>

* Remove redundant if condition

Signed-off-by: Mario Lubenka <[email protected]>

* Moves most change branch logic into pull service

Signed-off-by: Mario Lubenka <[email protected]>

* Completes comment

Signed-off-by: Mario Lubenka <[email protected]>

* Add Ref to ChangesPayload for logging changed target branches
instead of creating a new struct

Signed-off-by: Mario Lubenka <[email protected]>

* Revert changes to go.mod

Signed-off-by: Mario Lubenka <[email protected]>

* Directly use createComment method

Signed-off-by: Mario Lubenka <[email protected]>

* Return 404 if pull request is not found. Move written check up

Signed-off-by: Mario Lubenka <[email protected]>

* Remove variable declaration

Signed-off-by: Mario Lubenka <[email protected]>

* Return client errors on change pull request target errors

Signed-off-by: Mario Lubenka <[email protected]>

* Return error in commit.HasPreviousCommit

Signed-off-by: Mario Lubenka <[email protected]>

* Adds blank line

Signed-off-by: Mario Lubenka <[email protected]>

* Test patch before persisting new target branch

Signed-off-by: Mario Lubenka <[email protected]>

* Update patch before testing (not working)

Signed-off-by: Mario Lubenka <[email protected]>

* Removes patch calls when changeing pull request target

Signed-off-by: Mario Lubenka <[email protected]>

* Removes unneeded check for base name

Signed-off-by: Mario Lubenka <[email protected]>

* Moves ChangeTargetBranch completely to pull service. Update patch status.

Signed-off-by: Mario Lubenka <[email protected]>

* Set webhook mode after errors were validated

Signed-off-by: Mario Lubenka <[email protected]>

* Update PR in one transaction

Signed-off-by: Mario Lubenka <[email protected]>

* Move logic for check if head is equal with branch to pull model

Signed-off-by: Mario Lubenka <[email protected]>

* Adds missing comment and simplify return

Signed-off-by: Mario Lubenka <[email protected]>

* Adjust CreateComment method call

Signed-off-by: Mario Lubenka <[email protected]>
2019-12-16 14:20:25 +08:00
Lunny Xiaoandtechknowlogick 67b316a954 Refactor comment (#9330)
* Refactor comment

* fix test

* improve code
2019-12-15 16:57:34 -05:00
Brad Albrightandzeripath f6b29012e0 Add /milestones endpoint (#8733)
Create a /milestones endpoint which basically serves as a dashboard view for milestones, very similar to the /issues or /pulls page.

Closes #8232
2019-12-15 14:20:08 +00:00