]> source.dussan.org Git - gitea.git/commitdiff
fix: Add secret to all webhook's payload where it has been missing (#5208)
authorPeter Hoffmann <Hoffmann.P@gmx.net>
Tue, 30 Oct 2018 15:14:12 +0000 (16:14 +0100)
committerLauris BH <lauris@nix.lv>
Tue, 30 Oct 2018 15:14:12 +0000 (17:14 +0200)
* Updated dependency manager via `dep ensure -update code.gitea.io/sdk`
* Gopkg.toml was not changed as sdk version is set to "master"
* affects webhooks for: Delete, Fork, IssueComment, Release
* also contains changes from go-gitea/go-sdk#125 and hence a swagger update

Signed-off-by: Berengar W. Lehr <Berengar.Lehr@kompetenztest.de>
Resolves: #4732, #5173

Gopkg.lock
templates/swagger/v1_json.tmpl
vendor/code.gitea.io/sdk/gitea/admin_user.go
vendor/code.gitea.io/sdk/gitea/hook.go
vendor/code.gitea.io/sdk/gitea/issue.go
vendor/code.gitea.io/sdk/gitea/repo.go
vendor/code.gitea.io/sdk/gitea/repo_key.go
vendor/code.gitea.io/sdk/gitea/user_key.go

index 3002ca7d058b0aeaeeee6fe91461169150ad92bc..afd8953da2696d55d07be77c3654001b31fb81e5 100644 (file)
 
 [[projects]]
   branch = "master"
-  digest = "1:5e7f14543006a44047fb1d0df16da08b2ebc2428f1fd53bd8af26a2b34928b11"
+  digest = "1:bf4f822f636b99ac7d4f8fa5210a7439bacaf8d1f15d5783956bdd5dd2069bdc"
   name = "code.gitea.io/sdk"
   packages = ["gitea"]
   pruneopts = "NUT"
-  revision = "021567c9c12fe289b8980c34e81e6684434dd082"
+  revision = "11c860c8e49a23be26e6d6c6a039a46ad2ae1d27"
 
 [[projects]]
   digest = "1:3fcef06a1a6561955c94af6c7757a6fa37605eb653f0d06ab960e5bb80092195"
index 18fb34ff4525eeaf99ccf702d885b661e9567af9..efeabd6efb29408df0a0aedd6f22c2a0a3c6f9b9 100644 (file)
           "format": "date-time",
           "x-go-name": "Created"
         },
+        "fingerprint": {
+          "type": "string",
+          "x-go-name": "Fingerprint"
+        },
         "id": {
           "type": "integer",
           "format": "int64",
           "type": "string",
           "x-go-name": "Key"
         },
+        "key_id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "KeyID"
+        },
         "read_only": {
           "type": "boolean",
           "x-go-name": "ReadOnly"
         },
+        "repository": {
+          "$ref": "#/definitions/Repository"
+        },
         "title": {
           "type": "string",
           "x-go-name": "Title"
           "type": "string",
           "x-go-name": "Key"
         },
+        "key_type": {
+          "type": "string",
+          "x-go-name": "KeyType"
+        },
+        "read_only": {
+          "type": "boolean",
+          "x-go-name": "ReadOnly"
+        },
         "title": {
           "type": "string",
           "x-go-name": "Title"
         "url": {
           "type": "string",
           "x-go-name": "URL"
+        },
+        "user": {
+          "$ref": "#/definitions/User"
         }
       },
       "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
       "description": "Repository represents a repository",
       "type": "object",
       "properties": {
+        "archived": {
+          "type": "boolean",
+          "x-go-name": "Archived"
+        },
         "clone_url": {
           "type": "string",
           "x-go-name": "CloneURL"
index 4eab8c255fdbdb1c13a9ac7bea64e2f7a8abbd4a..089ff2964495b6cd851a82a67a022aad94c45e27 100644 (file)
@@ -42,17 +42,17 @@ type EditUserOption struct {
        FullName  string `json:"full_name" binding:"MaxSize(100)"`
        // required: true
        // swagger:strfmt email
-       Email            string `json:"email" binding:"Required;Email;MaxSize(254)"`
-       Password         string `json:"password" binding:"MaxSize(255)"`
-       Website          string `json:"website" binding:"MaxSize(50)"`
-       Location         string `json:"location" binding:"MaxSize(50)"`
-       Active           *bool  `json:"active"`
-       Admin            *bool  `json:"admin"`
-       AllowGitHook     *bool  `json:"allow_git_hook"`
-       AllowImportLocal *bool  `json:"allow_import_local"`
-       MaxRepoCreation  *int   `json:"max_repo_creation"`
-       ProhibitLogin    *bool  `json:"prohibit_login"`
-       AllowCreateOrganization *bool `json:"allow_create_organization"`
+       Email                   string `json:"email" binding:"Required;Email;MaxSize(254)"`
+       Password                string `json:"password" binding:"MaxSize(255)"`
+       Website                 string `json:"website" binding:"MaxSize(50)"`
+       Location                string `json:"location" binding:"MaxSize(50)"`
+       Active                  *bool  `json:"active"`
+       Admin                   *bool  `json:"admin"`
+       AllowGitHook            *bool  `json:"allow_git_hook"`
+       AllowImportLocal        *bool  `json:"allow_import_local"`
+       MaxRepoCreation         *int   `json:"max_repo_creation"`
+       ProhibitLogin           *bool  `json:"prohibit_login"`
+       AllowCreateOrganization *bool  `json:"allow_create_organization"`
 }
 
 // AdminEditUser modify user informations
index f346381679848f82ec54858e5148cb3609f747cc..80a5192d8eedae3af43d5a30ebf5ce9b6168decf 100644 (file)
@@ -199,7 +199,7 @@ type CreatePayload struct {
        Sender  *User       `json:"sender"`
 }
 
-// SetSecret FIXME
+// SetSecret modifies the secret of the CreatePayload
 func (p *CreatePayload) SetSecret(secret string) {
        p.Secret = secret
 }
@@ -246,6 +246,7 @@ const (
 
 // DeletePayload represents delete payload
 type DeletePayload struct {
+       Secret     string      `json:"secret"`
        Ref        string      `json:"ref"`
        RefType    string      `json:"ref_type"`
        PusherType PusherType  `json:"pusher_type"`
@@ -253,8 +254,9 @@ type DeletePayload struct {
        Sender     *User       `json:"sender"`
 }
 
-// SetSecret implements Payload
+// SetSecret modifies the secret of the DeletePayload
 func (p *DeletePayload) SetSecret(secret string) {
+       p.Secret = secret
 }
 
 // JSONPayload implements Payload
@@ -271,13 +273,15 @@ func (p *DeletePayload) JSONPayload() ([]byte, error) {
 
 // ForkPayload represents fork payload
 type ForkPayload struct {
+       Secret string      `json:"secret"`
        Forkee *Repository `json:"forkee"`
        Repo   *Repository `json:"repository"`
        Sender *User       `json:"sender"`
 }
 
-// SetSecret implements Payload
+// SetSecret modifies the secret of the ForkPayload
 func (p *ForkPayload) SetSecret(secret string) {
+       p.Secret = secret
 }
 
 // JSONPayload implements Payload
@@ -297,6 +301,7 @@ const (
 
 // IssueCommentPayload represents a payload information of issue comment event.
 type IssueCommentPayload struct {
+       Secret     string                 `json:"secret"`
        Action     HookIssueCommentAction `json:"action"`
        Issue      *Issue                 `json:"issue"`
        Comment    *Comment               `json:"comment"`
@@ -305,8 +310,9 @@ type IssueCommentPayload struct {
        Sender     *User                  `json:"sender"`
 }
 
-// SetSecret implements Payload
+// SetSecret modifies the secret of the IssueCommentPayload
 func (p *IssueCommentPayload) SetSecret(secret string) {
+       p.Secret = secret
 }
 
 // JSONPayload implements Payload
@@ -333,14 +339,16 @@ const (
 
 // ReleasePayload represents a payload information of release event.
 type ReleasePayload struct {
+       Secret     string            `json:"secret"`
        Action     HookReleaseAction `json:"action"`
        Release    *Release          `json:"release"`
        Repository *Repository       `json:"repository"`
        Sender     *User             `json:"sender"`
 }
 
-// SetSecret implements Payload
+// SetSecret modifies the secret of the ReleasePayload
 func (p *ReleasePayload) SetSecret(secret string) {
+       p.Secret = secret
 }
 
 // JSONPayload implements Payload
@@ -368,7 +376,7 @@ type PushPayload struct {
        Sender     *User            `json:"sender"`
 }
 
-// SetSecret FIXME
+// SetSecret modifies the secret of the PushPayload
 func (p *PushPayload) SetSecret(secret string) {
        p.Secret = secret
 }
@@ -520,7 +528,7 @@ type RepositoryPayload struct {
        Sender       *User          `json:"sender"`
 }
 
-// SetSecret set the payload's secret
+// SetSecret modifies the secret of the RepositoryPayload
 func (p *RepositoryPayload) SetSecret(secret string) {
        p.Secret = secret
 }
index fee7cd6f9fca228a39fb733b60c84918e305004d..8fc2b2bf7b13736175e403874a31c5387a6bf5a1 100644 (file)
@@ -152,3 +152,9 @@ type IssueDeadline struct {
        // swagger:strfmt date-time
        Deadline *time.Time `json:"due_date"`
 }
+
+// EditPriorityOption options for updating priority
+type EditPriorityOption struct {
+       // required:true
+       Priority int `json:"priority"`
+}
index 339cbd33deaacb1ae98aeeca363ea51cb44a92ec..8b7c0b1e681c670c722e1cda444a595076214103 100644 (file)
@@ -40,6 +40,7 @@ type Repository struct {
        Watchers      int         `json:"watchers_count"`
        OpenIssues    int         `json:"open_issues_count"`
        DefaultBranch string      `json:"default_branch"`
+       Archived      bool        `json:"archived"`
        // swagger:strfmt date-time
        Created time.Time `json:"created_at"`
        // swagger:strfmt date-time
index ec53311bdaa557269a4448e53b073bc392d68f1c..a1ae4584e0c12570d38d3228f8e2421990c09428 100644 (file)
@@ -13,13 +13,16 @@ import (
 
 // DeployKey a deploy key
 type DeployKey struct {
-       ID    int64  `json:"id"`
-       Key   string `json:"key"`
-       URL   string `json:"url"`
-       Title string `json:"title"`
+       ID          int64  `json:"id"`
+       KeyID       int64  `json:"key_id"`
+       Key         string `json:"key"`
+       URL         string `json:"url"`
+       Title       string `json:"title"`
+       Fingerprint string `json:"fingerprint"`
        // swagger:strfmt date-time
-       Created  time.Time `json:"created_at"`
-       ReadOnly bool      `json:"read_only"`
+       Created    time.Time   `json:"created_at"`
+       ReadOnly   bool        `json:"read_only"`
+       Repository *Repository `json:"repository,omitempty"`
 }
 
 // ListDeployKeys list all the deploy keys of one repository
index 4488c033f1a37d5f7337a1af4fafd2fac2eb5c93..cccaa65db91ef6d51202e006fc0655beb386a766 100644 (file)
@@ -19,7 +19,10 @@ type PublicKey struct {
        Title       string `json:"title,omitempty"`
        Fingerprint string `json:"fingerprint,omitempty"`
        // swagger:strfmt date-time
-       Created time.Time `json:"created_at,omitempty"`
+       Created  time.Time `json:"created_at,omitempty"`
+       Owner    *User     `json:"user,omitempty"`
+       ReadOnly bool      `json:"read_only,omitempty"`
+       KeyType  string    `json:"key_type,omitempty"`
 }
 
 // ListPublicKeys list all the public keys of the user