summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Add PR review webhook to Telegram (#9653)John Olheiser2020-01-081-0/+21
| | | | | | Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* fix #9648 | use filepath.IsAbs instead of path.IsAbs (#9651)65432020-01-081-5/+6
| | | | | | | | * fix #9648 * found next Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Graceful Queues: Issue Indexing and Tasks (#9363)zeripath2020-01-0727-643/+2453
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <18600385+guillep2k@users.noreply.github.com> * Update modules/indexer/issues/indexer.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/queue/queue_channel.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update modules/queue/queue_disk.go * Update modules/queue/queue_disk_channel.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * 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 <18600385+guillep2k@users.noreply.github.com> * 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 1f83b4fc9b9dabda186257b38c265fe7012f90df. Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add a /user/login landing page option (#9622)Timon Engelke2020-01-061-0/+3
| | | | | | * Add a /user/login landing page option * Add test case for login landing page
* Only show sender if it makes sense (#9601)John Olheiser2020-01-047-65/+71
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add branch protection option to block merge on requested changes. (#9592)David Svantesson2020-01-031-0/+1
| | | | | | | | | | | | | | | | | | | * 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 <42128690+jolheiser@users.noreply.github.com> * Copyright year. Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Some more e-mail notification fixes (#9596)mrsdizzie2020-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | * 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
* [API] Fix 9544 | return 200 when reaction already exist (#9550)65432019-12-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <art27@cantab.net> * fix test PART1 * extend FindReactionsOptions with UserID option * catch error on test * fix test PART2 * format ... Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
* update swagger info (#9558)65432019-12-311-4/+8
|
* Change markdown rendering from blackfriday to goldmark (#9533)zeripath2019-12-3112-265/+1064
| | | | | | | | | | | | | | | | | | | * 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 <lauris@nix.lv>
* Provide Default messages for merges (#9393)zeripath2019-12-302-9/+48
| | | | Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Fix repository issues pagination bug when there are more than one label ↵Lunny Xiao2019-12-281-0/+8
| | | | filter (#9512)
* Refactor webhooks to reduce code duplication (#9422)Cornel2019-12-2810-698/+534
| | | | | | | | | | | | | | | | | | | | | | | | * 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 <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
* Stop various tests from adding to the source tree (#9515)zeripath2019-12-284-11/+61
| | | | | | | Instead of just adding test generated files to .gitignore prevent them from being produced in the first place. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [Fix] AllowedReaction code (#9518)65432019-12-271-0/+3
| | | | | | | | | * optimize * CI.restart() Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net>
* [API] Extend times API (#9200)65432019-12-271-12/+20
| | | | | Extensively extend the times API. close #8833; close #8513; close #8559
* Fix deleted branch isn't removed when push the branch again (#9516)Lunny Xiao2019-12-271-0/+6
|
* Batch hook pre- and post-receive calls (#8602)zeripath2019-12-265-142/+320
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <xiaolunwen@gmail.com>
* fix datarace on issue indexer queue (#9490)Lunny Xiao2019-12-252-1/+6
|
* Wrap the code indexer (#9476)zeripath2019-12-243-13/+132
| | | | | | | | | | | | | | | | | | | | * 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 <matti@mdranta.net>
* [API] Extend contents with dates (#9464)65432019-12-245-7/+43
| | | | | | | | | | | | | | | * extend CommitTree func * make sure Date NOT nil * spell corection Co-Authored-By: zeripath <art27@cantab.net> * add TEST Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Use Req.URL.RequestURI() to cope with FCGI urls (#9473)zeripath2019-12-243-10/+10
| | | | | * Use Req.URL.RequestURI() to cope with FCGI urls * Add debug logging statement when forbidden in internal API.
* Prefix all user-generated IDs in markup (#9477)John Olheiser2019-12-233-9/+20
| | | | | | | | | | * 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 <john.olheiser@gmail.com>
* Refactor code indexer (#9313)Lunny Xiao2019-12-2310-631/+642
| | | | | | | | | | | | | | | | | | | | * Refactor code indexer * fix test * fix test * refactor code indexer * fix import * improve code * fix typo * fix test and make code clean * fix lint
* Set default ssh.minimum_key_sizes (#9466)mrsdizzie2019-12-221-1/+1
| | | | | | | | 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
* Add ActionCommentPull action (#9456)mrsdizzie2019-12-223-5/+9
| | | | | | | | | | | * 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 <xiaolunwen@gmail.com>
* fixed bug in GitTreeBySHA where pulling items from a page other than page 1 ↵Brad Albright2019-12-221-5/+5
| | | | would fail because the wrong var was used to set the entries to return (#9459)
* Fix wrong notification on merge (#9450)guillep2k2019-12-201-1/+1
|
* Swagger info corrections (#9441)65432019-12-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 :+1: * use ctx.InternalServerError * Revert "use numbers and not http.Status___ enum" This reverts commit b1ff386e2418ed6a7f183e756b13277d701278ef. * use http.Status* enum everywhere
* Use OriginalURL insead of CloneAddr in migration logging (#9418)mrsdizzie2019-12-181-2/+2
| | | | | 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.
* Remove unsued struct (#9405)Lauris BH2019-12-181-6/+0
|
* Fix Slack webhook payload title generation to work with Mattermost (#9378)Cornel2019-12-181-73/+86
| | | | | | * 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
* Sleep longer if request speed is over github limitation (#9335)Lunny Xiao2019-12-167-15/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* AuthorizedKeysCommand should not query db directly (#9371)zeripath2019-12-161-0/+25
| | | | | | | | * AuthorizedKeysCommand should not query db directly * Update routers/private/internal.go * Fix import order
* Remove text from action-only webhooks (#9377)John Olheiser2019-12-174-72/+0
| | | | | | | | | | * Remove text from contextual webhooks Signed-off-by: jolheiser <john.olheiser@gmail.com> * Missed one in Telegram Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Change target branch for pull request (#6488)Mario Lubenka2019-12-166-1/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Adds functionality to change target branch of created pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use const instead of var in JavaScript additions Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check if branches are equal and if PR already exists before changing target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Make sure to check all commits Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Print error messages for user as error flash message Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Disallow changing target branch of closed or merged pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Resolve conflicts after merge of upstream/master Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Change order of branch select fields Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes duplicate check Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use ctx.Tr for translations Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Recompile JS Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use correct translation namespace Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove redundant if condition Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves most change branch logic into pull service Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Completes comment Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Add Ref to ChangesPayload for logging changed target branches instead of creating a new struct Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Revert changes to go.mod Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Directly use createComment method Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return 404 if pull request is not found. Move written check up Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove variable declaration Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return client errors on change pull request target errors Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return error in commit.HasPreviousCommit Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds blank line Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Test patch before persisting new target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update patch before testing (not working) Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes patch calls when changeing pull request target Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes unneeded check for base name Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves ChangeTargetBranch completely to pull service. Update patch status. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Set webhook mode after errors were validated Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update PR in one transaction Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Move logic for check if head is equal with branch to pull model Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds missing comment and simplify return Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adjust CreateComment method call Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Refactor comment (#9330)Lunny Xiao2019-12-158-9/+66
| | | | | | | | * Refactor comment * fix test * improve code
* Add /milestones endpoint (#8733)Brad Albright2019-12-152-0/+3
| | | | | Create a /milestones endpoint which basically serves as a dashboard view for milestones, very similar to the /issues or /pulls page. Closes #8232
* Fix missed change to GetManager() (#9361)zeripath2019-12-151-1/+1
|
* Graceful: Xorm, RepoIndexer, Cron and Others (#9282)zeripath2019-12-1518-166/+353
| | | | | | | | | | | | * Change graceful to use a singleton obtained through GetManager instead of a global. * Graceful: Make TestPullRequests shutdownable * Graceful: Make the cron tasks graceful * Graceful: AddTestPullRequest run in graceful ctx * Graceful: SyncMirrors shutdown * Graceful: SetDefaultContext for Xorm to be HammerContext * Avoid starting graceful for migrate commands and checkout * Graceful: DeliverHooks now can be shutdown * Fix multiple syncing errors in modules/sync/UniqueQueue & Make UniqueQueue closable * Begin the process of making the repo indexer shutdown gracefully
* Push to create repo (#8419)John Olheiser2019-12-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add push-create to SSH serv Signed-off-by: jolheiser <john.olheiser@gmail.com> * Cannot push for another user unless admin Signed-off-by: jolheiser <john.olheiser@gmail.com> * Get owner in case admin pushes for another user Signed-off-by: jolheiser <john.olheiser@gmail.com> * Set new repo ID in result Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update to service and use new org perms Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move pushCreateRepo to services Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix import order Signed-off-by: jolheiser <john.olheiser@gmail.com> * Changes for @guillep2k * Check owner (not user) in SSH * Add basic tests for created repos (private, not empty) Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move some repository methods from models to modules/repository (#9353)Lunny Xiao2019-12-142-2/+226
| | | | | | * Move some repository methods from models to modules/repository * fix test
* DefaultBranch needs to be prefixed by BranchPrefix (#9356)zeripath2019-12-141-1/+1
|
* Default NO_REPLY_ADDRESS to DOMAIN (#9325)zeripath2019-12-131-1/+1
| | | | | | | | | | | * Default NO_REPLY_ADDRESS to DOMAIN The default NO_REPLY_ADDRESS was previously noreply.example.org This PR changes this to default to the default DOMAIN for gitea. * Change default to noreply.%(DOMAIN)s * Change default to "noreply" + Domain
* deps: update and fix chardet import (#9351)Antoine GIRARD2019-12-141-1/+1
|
* Remove SavePatch and generate patches on the fly (#9302)zeripath2019-12-132-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | * Save patches to temporary files * Remove SavePatch and generate patches on the fly * Use ioutil.TempDir * fixup! Use ioutil.TempDir * fixup! fixup! Use ioutil.TempDir * RemoveAll LocalCopyPath() in initIntergrationTest * Default to status checking on PR creation * Remove unnecessary set to StatusChecking * Protect against unable to load repo * Handle conflicts * Restore original conflict setting * In TestPullRequests update status to StatusChecking before running TestPatch
* Fix nondeterministic behavior (#9341)Mura Li2019-12-132-2/+2
| | | | | | | | | The underlying implementation of os.exec uses channels and goroutines. It is possible to have time-variant error values returned from Cmd.Wait depending on which comes first. Also, the git subcommand and options should be separated tokens. Fixes a flaky test in modules/git/command_test.go
* fix issue indexer not triggered when migrating a repository (#9332)Lunny Xiao2019-12-122-16/+22
|
* Make repository management section handle lfs locks (#8726)zeripath2019-12-122-2/+86
| | | | | | | | | | | | | | | | | | | | * Make repository maangement section handle lfs locks * Add check attribute handling and handle locking paths better * More cleanly check-attributes * handle error * Check if file exists in default branch before linking to it. * fixup * Properly cleanPath * Use cleanPath * Sigh
* [API] extend StopWatch (#9196)65432019-12-111-0/+19
| | | | | | | | | | | | | | * squash api-stopwatch * fix prepair logic! + add Tests * fix lint * more robust time compare * delete responce 202 -> 204 * change http responce in test too