Skip to content

Commit 9810a44

Browse files
committed
fix imports and revert changes to webhook_slack.go
1 parent 0481644 commit 9810a44

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

models/webhook.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ import (
1313
"strings"
1414
"time"
1515

16-
"github.com/go-xorm/xorm"
17-
gouuid "github.com/satori/go.uuid"
18-
19-
api "code.gitea.io/sdk/gitea"
20-
2116
"code.gitea.io/gitea/modules/httplib"
2217
"code.gitea.io/gitea/modules/log"
2318
"code.gitea.io/gitea/modules/setting"
2419
"code.gitea.io/gitea/modules/sync"
20+
api "code.gitea.io/sdk/gitea"
21+
22+
"github.com/go-xorm/xorm"
23+
gouuid "github.com/satori/go.uuid"
2524
)
2625

2726
// HookQueue is a global queue of web hooks

models/webhook_discord.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import (
88
"strings"
99

1010
"code.gitea.io/git"
11-
api "code.gitea.io/sdk/gitea"
12-
1311
"code.gitea.io/gitea/modules/setting"
12+
api "code.gitea.io/sdk/gitea"
1413
)
1514

1615
type (

models/webhook_slack.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ func getSlackCreatePayload(p *api.CreatePayload, slack *SlackMeta) (*SlackPayloa
8686

8787
repoLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
8888
refLink := SlackLinkFormatter(p.Repo.HTMLURL+"/src/"+refName, refName)
89-
90-
format := "[%s:%s] %s created by %s"
91-
text := fmt.Sprintf(format, repoLink, refLink, p.RefType, p.Sender.UserName)
89+
text := fmt.Sprintf("[%s:%s] %s created by %s", repoLink, refLink, p.RefType, p.Sender.UserName)
9290

9391
return &SlackPayload{
9492
Channel: slack.Channel,
@@ -119,9 +117,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
119117

120118
repoLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
121119
branchLink := SlackLinkFormatter(p.Repo.HTMLURL+"/src/"+branchName, branchName)
122-
123-
format := "[%s:%s] %s pushed by %s"
124-
text := fmt.Sprintf(format, repoLink, branchLink, commitString, p.Pusher.UserName)
120+
text := fmt.Sprintf("[%s:%s] %s pushed by %s", repoLink, branchLink, commitString, p.Pusher.UserName)
125121

126122
var attachmentText string
127123
// for each commit, generate attachment text

routers/repo/webhook.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ import (
1111
"fmt"
1212
"strings"
1313

14-
"github.com/Unknwon/com"
15-
1614
"code.gitea.io/git"
17-
api "code.gitea.io/sdk/gitea"
18-
1915
"code.gitea.io/gitea/models"
2016
"code.gitea.io/gitea/modules/auth"
2117
"code.gitea.io/gitea/modules/base"
2218
"code.gitea.io/gitea/modules/context"
2319
"code.gitea.io/gitea/modules/setting"
20+
api "code.gitea.io/sdk/gitea"
21+
22+
"github.com/Unknwon/com"
2423
)
2524

2625
const (

0 commit comments

Comments
 (0)