summaryrefslogtreecommitdiffstats
path: root/modules/webhook
Commit message (Collapse)AuthorAgeFilesLines
* Update golangci-lint to version 1.31.0 (#13102)kolaente2020-10-111-6/+6
| | | | | | | This PR updates golangci-lint to the latest version 1.31.0. The upgrade introduced a new check for which I've fixed or disabled most cases. Signed-off-by: kolaente <k@knt.li>
* Fix line break for MS teams webhook (#13081)Iván Valdés2020-10-091-1/+1
| | | | | Signed-off-by: Ivan Valdes <ivan@vald.es> Co-authored-by: Lauris BH <lauris@nix.lv>
* Refactor webhook payload convertion (#12310)Lunny Xiao2020-09-0412-454/+397
| | | | | | | * Refactor webhook payload convertion * Fix lint Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Avoid sending "0 new commits" webhooks (#12212)S7evinK2020-09-022-2/+10
| | | | | | | | | | | | | | | | | | | | | * Avoid sending "0 new commits" webhook Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Revert "Avoid sending "0 new commits" webhook" This reverts commit 1f47ccfacd81470e2c33a02bb8d255172aa4ec08. * Move commit count check to more central place * Make tests pass * Update modules/webhook/webhook.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Don't use legacy method to send Matrix Webhook (#12348)S7evinK2020-07-303-8/+59
| | | | | | | | | | | | | | | | | * Don't use legacy send for messages * Add migrations to ensure Matrix webhooks use PUT * Set HTTP method to PUT as default * Fix sql condition.. Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Rename getTxnID -> getMatrixTxnID * Use local variable instead of constant value Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* prefer NoError/Error over Nil/NotNil (#12271)Stephen Solka2020-07-194-16/+16
|
* Fix comments webhook panic (#12046)Cornel2020-06-248-9/+39
| | | | | | | * Fix webhook comment handling type cast panic * Handle HookIssueReviewed action in webhook Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Handle panics that percolate up to the graceful module (#11291)zeripath2020-05-141-0/+8
| | | | | | | | | | | | | | | | | | * Handle panics in graceful goroutines Adds a some deferred functions to handle panics in graceful goroutines Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle panic in webhook.Deliver Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle panic in mirror.syncMirror Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix ref links in issue overviews for tags (#8742)Sijmen Schoon2020-05-141-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add Matrix webhook (#10831)S7evinK2020-03-284-0/+467
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Matrix webhook Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add template and related translations for Matrix hook Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add actual webhook routes and form Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add missing file Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Update modules/webhook/matrix_test.go * Use stricter regex to replace URLs Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Escape url and text Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Remove unnecessary whitespace * Fix copy and paste mistake Co-Authored-By: Tulir Asokan <tulir@maunium.net> * Fix indention inconsistency * Use Authorization header instead of url parameter * Add raw commit information to webhook Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Tulir Asokan <tulir@maunium.net>
* System-wide webhooks (#10546)James Lakin2020-03-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Create system webhook column (and migration) * Create system webhook DB methods Based on the default webhook ones * Modify router to handle system webhooks and default ones * Remove old unused admin nav template * Adjust orgRepoCtx to differentiate system and default webhook URLs * Assign IsSystemWebhook when creating webhooks * Correctly use booleans for IsSystemWebhook * Use system webhooks when preparing webhooks for payload * Add UI and locale changes * Use router params to differentiate admin hook pages * Fix deleting admin webhooks and rename method * Add clarity to webhook docs * Revert "Remove old unused admin nav template" This reverts commit 191a20a7389fe5f6256b0ad6aafd04b9b0e295c5. * Rename WebHooksNewPost to GiteaHooksNewPost for clarity * Reintroduce blank line lost during merge conflict Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Granular webhook events (#9626)John Olheiser2020-03-067-35/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add PR reviews and API coverage Signed-off-by: jolheiser <john.olheiser@gmail.com> * Split up events Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add migration and locale Signed-off-by: jolheiser <john.olheiser@gmail.com> * Format Signed-off-by: jolheiser <john.olheiser@gmail.com> * Revert IsPull Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix comments Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix tests Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix PR reviews Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix issue_comment Signed-off-by: jolheiser <john.olheiser@gmail.com> * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Migrations Signed-off-by: jolheiser <john.olheiser@gmail.com> * Backwards compatible API Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix feishu Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move session commit Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Add feishu webhook support (#10229)Lunny Xiao2020-02-122-0/+206
| | | | Add feishu webhook support
* Fix RocketChat (#9908)John Olheiser2020-01-211-10/+5
| | | | | | | | | | | | | | | | * Fix RocketChat?? Signed-off-by: jolheiser <john.olheiser@gmail.com> * Don't send attachment for repo create/delete Signed-off-by: jolheiser <john.olheiser@gmail.com> * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add HTML URL to API Issues (#9654)John Olheiser2020-01-084-4/+4
| | | | | | | | | | | | * Add HTML URL to API Issues Signed-off-by: jolheiser <john.olheiser@gmail.com> * Swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* 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>
* Only show sender if it makes sense (#9601)John Olheiser2020-01-047-65/+71
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* 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>
* 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
* 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>
* Graceful: Xorm, RepoIndexer, Cron and Others (#9282)zeripath2019-12-151-19/+44
| | | | | | | | | | | | * 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
* Make consistent links to repository in the Slack/Mattermost notificiations ↵Lauris BH2019-11-301-33/+38
| | | | (#9205)
* Webhook support custom proxy (#8760)Lunny Xiao2019-11-082-3/+72
| | | | | | | | | | | | * Webhook support custom proxy * Add glob support on webhook proxy host rules * fix app.ini.sample * improve code and app.ini.sample * update cheetsheet about added webhook options
* Move more webhook codes from models to webhook module (#8802)Lunny Xiao2019-11-037-5/+2536
| | | | * Move more webhook codes from models to webhook module
* Rename HookQueue to hookQueue (#8778)Lunny Xiao2019-11-022-6/+16
| | | | | | * Rename HookQueue to hookQueue * fix lint
* Move webhook to a standalone package under modules (#8747)Lunny Xiao2019-11-014-0/+470
* Move webhook to a standalone package under modules * fix test * fix comments