Commit Graph

65 Commits (0a6ce3eaf19649e2254f9c1ca72288d6c01edbf2)

Author SHA1 Message Date
6543 d453533beb
[Refactor] Move APIFormat functions into convert package ()
* USER APIFormat -> ToUser

* Migrate more and mark APIFormat deprecated

* models.Comment APIFormat() -> convert.ToComment

* models.Release APIFormat() -> convert.ToRelease

* models.Attachments APIFormat() -> convert.ToReleaseAttachments

* models.CommitStatus APIFormat() -> convert.ToCommitStatus

* finish migration to convert.ToUser

* Move Test

* Imprufe Test

* fix test

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
S7evinK bf60146444
Don't use legacy method to send Matrix Webhook ()
* 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>
kolaente c72a471215
Fix webhook template when validation errors occur ()
Signed-off-by: kolaente <k@knt.li>
S7evinK 828a27feeb
Add Matrix webhook ()
* 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>
James Lakin a9f4489bbc
System-wide webhooks ()
* 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 191a20a738.

* 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>
John Olheiser 3f1c0841cb
Granular webhook events ()
* 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>
James Lakin c08c975d36
Fix redirection path if Slack webhook channel is invalid ()
The path to the hook config is already defined by orgRepoCtx

Co-authored-by: Lauris BH <lauris@nix.lv>
Lunny Xiao 83a8944fcf
Add feishu webhook support ()
Add feishu webhook support
SpaWn2KiLl 1f01f53c53 API add/generalize pagination ()
* paginate results

* fixed deadlock

* prevented breaking change

* updated swagger

* go fmt

* fixed find topic

* go mod tidy

* go mod vendor with go1.13.5

* fixed repo find topics

* fixed unit test

* added Limit method to Engine struct; use engine variable when provided; fixed gitignore

* use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors

* set Page value on Home route

* improved memory allocations

* fixed response headers

* removed logfiles

* fixed import order

* import order

* improved swagger

* added function to get models.ListOptions from context

* removed pagesize diff on unit test

* fixed imports

* removed unnecessary struct field

* fixed go fmt

* scoped PR

* code improvements

* code improvements

* go mod tidy

* fixed import order

* fixed commit statuses session

* fixed files headers

* fixed headers; added pagination for notifications

* go mod tidy

* go fmt

* removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list

* Apply suggestions from code review

Co-Authored-By: 6543 <6543@obermui.de>
Co-Authored-By: zeripath <art27@cantab.net>

* fixed build error

* CI.restart()

* fixed merge conflicts resolve

* fixed conflicts resolve

* improved FindTrackedTimesOptions.ToOptions() method

* added backwards compatibility on ListReleases request; fixed issue tracked time ToSession

* fixed build error; fixed swagger template

* fixed swagger template

* fixed ListReleases backwards compatibility

* added page to user search route

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Lunny Xiao a966a0298e Move more webhook codes from models to webhook module ()
* Move more webhook codes from models to webhook module
Lunny Xiao f518fe6662
Rename HookQueue to hookQueue ()
* Rename HookQueue to hookQueue

* fix lint
Lunny Xiao 0e7f7df3cf Move webhook to a standalone package under modules ()
* Move webhook to a standalone package under modules

* fix test

* fix comments
Aam Surganda bcd4af483d Change general form binding to gogs form ()
WGH 6ddd3b0b47 Implement webhook branch filter ()
* Fix validate() function to handle errors in embedded anon structs

* Implement webhook branch filter

See , .
Tamal Saha 171b359877 Use gitea forked macaron ()
Signed-off-by: Tamal Saha <tamal@appscode.com>
kolaente f9ec2f89f2 Add golangci ()
techknowlogick 5fb1ad7011 Webhook Logs show proper HTTP Method, and allow change HTTP method in form ()
* Fix  - logs show proper HTTP Method, and allow change HTTP method
in form

* enforce POST method for webhook

* set default if method is empty
Lunny Xiao 34eee25bd4
Move sdk structs to modules/structs ()
* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
Simon a2a006a5d5 Add GET requests to webhook ()
* Add GET requests to webhook

* make fmt

* Handle invalid http method on webhook

* Uppercase http method in webhook

* Rename v85.go to v86.go

* make fmt
Daniel Grier b9d1fb6de3 Add support for MS Teams webhooks ()
techknowlogick 56da256853
Telegram webhook ()
Lunny Xiao d578b71d61
move code.gitea.io/git to code.gitea.io/gitea/modules/git ()
* move code.gitea.io/git to code.gitea.io/gitea/modules/git

* fix imports

* fix fmt

* fix misspell

* remove wrong tests data

* fix unit tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* enable Debug to trace the failure tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* comment commit count tests since git clone depth is 50

* fix tests

* update from code.gitea.io/git

* revert change to makefile
Russell Aunger b34996a629 Implement Default Webhooks ()
Partially implement .
Add "Default Webhooks" page in site admin UI.
Persist to the existing webhooks table, but store with RepoID=0 and OrgID=0.
Upon repo creation, copy the set of default webhooks into the new repo.
Lanre Adelowo be48397945 Slack webhook channel name cannot be empty or just contain an hashtag ()
Russell Aunger 9ae7664df7 Fix webhook type conflation. ()
- Fix typo that caused Gogs hooks to be created as Gitea hooks.
- Fix typo that caused Gogs hooks to be duplicated upon edit (though this bug was masked by the previous one).

Signed-off-by: Russell Aunger <rba@live.com>
Lunny Xiao 60d95a0b85
fix bugs caused by ()
Lunny Xiao 24941a1046
Add more webhooks support and refactor webhook templates directory ()
* add more webhook support

* move hooks templates to standalone dir and add more webhooks ui

* fix tests

* update vendor checksum

* add more webhook support

* move hooks templates to standalone dir and add more webhooks ui

* fix tests

* update vendor checksum

* update vendor

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* load attributes when created release

* update comparsion doc
Morgan Bazalgette 65861900cd Handle refactor ()
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound

* Change Handle(403) to NotFound, avoid using macaron's NotFound
Elouan Martinet 5057c6b43f Fix guide link for webhooks in repository settings () ()
Signed-off-by: Elouan Martinet <exa@elou.world>
Lunny Xiao 10b54df2b2 Add dingtalk webhook ()
* add dingtalk webhook type

* add vendor

* some fixes

* fix name check

* fix name check & improvment
David Schneiderbauer 0cef8ce192 fix panic on gogs webhook creation ()
* fix panic on gogs webhook creation

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>

* fix panic in gogs webhook edit

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Ethan Koenig b689bb6180 Webhooks for repo creation/deletion ()
* Webhooks for repo creation/deletion

* add createHookTask

* Add handles for GetSlackPayload and GetDiscordPayload
Lunny Xiao 3e6fed368b fix webhook test ()
* fix webhook test

* fix error message

* fix typo
Lunny Xiao 15d3872281 fix missing orgnization discord webhook ()
Lunny Xiao ced50e0ec1 Implementation of discord webhook ()
* implementation of discord webhook

* fix webhooks

* fix typo and unnecessary color values

* fix typo

* fix imports and revert changes to webhook_slack.go
Rémy Boulanouar e0c6ab2d44 Add Gitea Webhook ()
* Replace Gogs by Gitea

* Fix missing changes

* Create Gitea webhook and put Gogs webhook apart.
Lunny Xiao 47a7529d96 update code.gitea.io/git ()
Ethan Koenig 04b9a7e7a2 Bug fixes for repo permissions in API
Also move duplicated code into repo.APIFormat(..)
Bwko a4ece1f223 Fixes typos
Lunny Xiao 3917ed45de golint fixed for routers ()
Sandro Santilli a1c5f02444 Fix import path of go-sdk ()
From code.gitea.io/go-sdk/gitea
  To code.gitea.io/sdk/gitea
Sandro Santilli 4247304f5a Update import paths from github.com/go-gitea to code.gitea.io ()
- Update import paths from github.com/go-gitea to code.gitea.io
- Fix import path for travis

See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
Sandro Santilli 864d1b1f9f Fix type in unused constant name ()
* Write LDAP, SMTP, PAM, DLDAP back to all uppercase

* Fix type in unused constant name

* Other MixCased fixes

* Complete MixerCasing of template constants

* Re uppercase LTS and LDAPS suffixes

* Uppercase JSON suffix in constant names

* Proper case LoginNoType

* Prefix unexported template path constants with "tpl"
Sandro Santilli aadd7dcdc3 And others
Sandro Santilli 0b62aeb495 More MixedCase consts
Sandro Santilli 80eea77953 Use MixedCase constant names
See https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps
Thomas Boerger 4c6c16f358
Replaced go-gogs-client with go-sdk imports
Thomas Boerger 77f9c7e571
Fixed links to sdk docs
Sandro Santilli 6e4252dad4 Replace gogits/git-module dependency with go-gitea/git ()
* Replace gogits/git-module dependency with go-gitea/git

Fixes 

* Remove git alias for git module import (not needed)
Rémy Boulanouar 2d68bd1ef9 Change import reference to match gitea instead of gogs ()