forked from p85947160/gitea
* 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> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
79c1d48532
commit
db9342c854
|
@ -233,6 +233,8 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
|
||||||
IconURL: slack.IconURL,
|
IconURL: slack.IconURL,
|
||||||
Attachments: []SlackAttachment{{
|
Attachments: []SlackAttachment{{
|
||||||
Color: slack.Color,
|
Color: slack.Color,
|
||||||
|
Title: p.Repo.HTMLURL,
|
||||||
|
TitleLink: p.Repo.HTMLURL,
|
||||||
Text: attachmentText,
|
Text: attachmentText,
|
||||||
}},
|
}},
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -289,12 +291,11 @@ func getSlackPullRequestApprovalPayload(p *api.PullRequestPayload, slack *SlackM
|
||||||
func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*SlackPayload, error) {
|
func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*SlackPayload, error) {
|
||||||
senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
|
senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
|
||||||
repoLink := SlackLinkFormatter(p.Repository.HTMLURL, p.Repository.FullName)
|
repoLink := SlackLinkFormatter(p.Repository.HTMLURL, p.Repository.FullName)
|
||||||
var text, title, attachmentText string
|
var text string
|
||||||
|
|
||||||
switch p.Action {
|
switch p.Action {
|
||||||
case api.HookRepoCreated:
|
case api.HookRepoCreated:
|
||||||
text = fmt.Sprintf("[%s] Repository created by %s", repoLink, senderLink)
|
text = fmt.Sprintf("[%s] Repository created by %s", repoLink, senderLink)
|
||||||
title = p.Repository.HTMLURL
|
|
||||||
case api.HookRepoDeleted:
|
case api.HookRepoDeleted:
|
||||||
text = fmt.Sprintf("[%s] Repository deleted by %s", repoLink, senderLink)
|
text = fmt.Sprintf("[%s] Repository deleted by %s", repoLink, senderLink)
|
||||||
}
|
}
|
||||||
|
@ -304,12 +305,6 @@ func getSlackRepositoryPayload(p *api.RepositoryPayload, slack *SlackMeta) (*Sla
|
||||||
Text: text,
|
Text: text,
|
||||||
Username: slack.Username,
|
Username: slack.Username,
|
||||||
IconURL: slack.IconURL,
|
IconURL: slack.IconURL,
|
||||||
Attachments: []SlackAttachment{{
|
|
||||||
Color: slack.Color,
|
|
||||||
Title: title,
|
|
||||||
TitleLink: title,
|
|
||||||
Text: attachmentText,
|
|
||||||
}},
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue