Content-Length: 1278615 | pFad | http://github.com/gogs/gogs/pull/7282/files

85 Optionally enclose commit title and/or author into backticks by jurajlutter · Pull Request #7282 · gogs/gogs · GitHub
Skip to content

Optionally enclose commit title and/or author into backticks #7282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ DELIVER_TIMEOUT = 15
SKIP_TLS_VERIFY = false
; The number of history information in each page.
PAGING_NUM = 10
; Enclose commit author into backticks for Slack
SLACK_BACKTICKS_AUTHOR = false
; Enclose commit titls into backticks for Slack
SLACK_BACKTICKS_TITLE = false

; General settings of loggers.
[log]
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_bg-BG.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Конфигурация на уеб-куки
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Конфигурация на git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_cs-CZ.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Nastavení webových háčků
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Konfigurace Gitu
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_de-DE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook-Konfiguration
config.webhook.types=Typen
config.webhook.deliver_timeout=Zeitlimit für Zustellung
config.webhook.skip_tls_verify=TLS-Prüfung überspringen
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git Konfiguration
config.git.disable_diff_highlight=Diff-Syntaxhervorhebung ausschalten
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,8 @@ config.webhook_config=Webhook Configuration
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git Configuration
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,8 @@ config.webhook_config = Webhook configuration
config.webhook.types = Types
config.webhook.deliver_timeout = Deliver timeout
config.webhook.skip_tls_verify = Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config = Git configuration
config.git.disable_diff_highlight = Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_es-ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Configuración de Webhooks
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configuración de Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_fa-IR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,8 @@ config.webhook_config=تنظیمات Webhook
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=پیکربندی Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_fi-FI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webkoukku asetukset
config.webhook.types=Tyypit
config.webhook.deliver_timeout=Toimitus aikakatkaisu
config.webhook.skip_tls_verify=Ohita TLS tarkistaminen
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git asetukset
config.git.disable_diff_highlight=Poista koodinväritys käytöstä diff-näkymässä
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_fr-FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Configuration Webhook
config.webhook.types=Types
config.webhook.deliver_timeout=Délai de livraison
config.webhook.skip_tls_verify=Ignorer la vérification TLS
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configuration de Git
config.git.disable_diff_highlight=Désactiver la coloration syntaxique des différences
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_gl-ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,8 @@ config.webhook_config=Configuración de Webhooks
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configuración de git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_hu-HU.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook beállítás
config.webhook.types=Típusok
config.webhook.deliver_timeout=Kézbesítési időtúllépés
config.webhook.skip_tls_verify=TLS ellenőrzés kihagyása
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git konfiguráció
config.git.disable_diff_highlight=Különbségi szintakszis kiemelésének kikapcsolása
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_id-ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook Konfigurasi
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Konfigurasi Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_it-IT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Configurazione Webhook
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configurazione Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_ja-JP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook設定
config.webhook.types=Types
config.webhook.deliver_timeout=配信のタイムアウト
config.webhook.skip_tls_verify=TLS検証をスキップ
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git 設定
config.git.disable_diff_highlight=Diff のシンタックスハイライトを無効にする
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_ko-KR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,8 @@ config.webhook_config=웹훅 설정
config.webhook.types=유형
config.webhook.deliver_timeout=배달 제한 시간
config.webhook.skip_tls_verify=TLS 검증 건너뛰기
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=깃 설정
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_lv-LV.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Tīkla āķu konfigurācija
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git konfigurācija
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_mn-MN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook тохиргоо
config.webhook.types=Төрлүүд
config.webhook.deliver_timeout=Дамжуулах хугацаа
config.webhook.skip_tls_verify=TLS баталгаажуулалтыг алгасах
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git тохиргоо
config.git.disable_diff_highlight=Ялгааг тодруулж харуулахыг болих
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_nl-NL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook configuratie
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Gitconfiguratie
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_pl-PL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Konfiguracja webhooka
config.webhook.types=Typy
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Pomiń weryfikację TLS
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Konfiguracja Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_pt-BR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Configuração de Hook da Web
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configuração do Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_pt-PT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Configuração de WebHook
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configuração Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_ro-RO.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webhook configurare
config.webhook.types=Tipuri
config.webhook.deliver_timeout=Timeout pentru livrare
config.webhook.skip_tls_verify=Sari peste verificarea TLS
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Configurare Git
config.git.disable_diff_highlight=Dezactivează evidențierea sintaxei diff
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_ru-RU.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Конфигурация Webhook
config.webhook.types=Типы
config.webhook.deliver_timeout=Таймаут доставки
config.webhook.skip_tls_verify=Пропустить проверку TLS
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Конфигурация GIT
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_sk-SK.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Nastavenie webových háčikov
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Konfigurácia Gitu
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_sr-SP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Подешавања Webhook
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git конфигурација
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_sv-SE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Webbkrokskonfiguration
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git-konfiguration
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_tr-TR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Web İstekleri Yapılandırması
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git Yapılandırması
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_uk-UA.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Налаштування web-хуків
config.webhook.types=Типи
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Налаштування git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_vi-VN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Cấu hình Webhook
config.webhook.types=Kiểu
config.webhook.deliver_timeout=Thời gian chờ phân phối
config.webhook.skip_tls_verify=Bỏ qua xác thực TLS
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Cấu hình Git
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_zh-CN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,8 @@ config.webhook_config=Web 钩子配置
config.webhook.types=类型
config.webhook.deliver_timeout=推送超时
config.webhook.skip_tls_verify=忽略 TLS 验证
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git 配置
config.git.disable_diff_highlight=禁用差异对比语法高亮
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_zh-HK.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Web 鉤子配置
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git configuration
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
2 changes: 2 additions & 0 deletions conf/locale/locale_zh-TW.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ config.webhook_config=Web 鉤子配置
config.webhook.types=Types
config.webhook.deliver_timeout=Deliver timeout
config.webhook.skip_tls_verify=Skip TLS verify
config.webhook.slack_backticks_author=Enclose commit author into backticks for Slack
config.webhook.slack_backticks_title=Enclose commit title into backticks for Slack

config.git_config=Git 配置
config.git.disable_diff_highlight=Disable diff syntax highlight
Expand Down
6 changes: 6 additions & 0 deletions internal/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ func Init(customConf string) error {
}
LFS.ObjectsPath = ensureAbs(LFS.ObjectsPath)

// ****************************
// ----- Webhook settings -----
// ****************************
Webhook.SlackBackticksTitle = false;
Webhook.SlackBackticksAuthor = false;

handleDeprecated()

if err = File.Section("cache").MapTo(&Cache); err != nil {
Expand Down
10 changes: 6 additions & 4 deletions internal/conf/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ var (

// Webhook settings
Webhook struct {
Types []string
DeliverTimeout int
SkipTLSVerify bool `ini:"SKIP_TLS_VERIFY"`
PagingNum int
Types []string
DeliverTimeout int
SkipTLSVerify bool `ini:"SKIP_TLS_VERIFY"`
PagingNum int
SlackBackticksAuthor bool `ini:"SLACK_BACKTICKS_AUTHOR"`
SlackBackticksTitle bool `ini:"SLACK_BACKTICKS_TITLE"`
}

// Markdown settings
Expand Down
28 changes: 23 additions & 5 deletions internal/db/webhook_slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ func SlackLinkFormatter(url, text string) string {
return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
}

func SlackEncloseAuthor(author string) string {
enclose := conf.Webhook.SlackBackticksAuthor;
f := "%s"
if enclose {
f = "`" + f + "`"
}
return fmt.Sprintf(f, author)
}

func SlackEncloseTitle(title string) string {
enclose := conf.Webhook.SlackBackticksTitle;
f := "%s"
if enclose {
f = "`" + f + "`"
}
return fmt.Sprintf(f, title)
}

// getSlackCreatePayload composes Slack payload for create new branch or tag.
func getSlackCreatePayload(p *api.CreatePayload) *SlackPayload {
refName := git.RefShortName(p.Ref)
Expand Down Expand Up @@ -128,7 +146,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) *SlackPayload {
var attachmentText string
// for each commit, generate attachment text
for i, commit := range p.Commits {
attachmentText += fmt.Sprintf("%s: %s - %s", SlackLinkFormatter(commit.URL, commit.ID[:7]), SlackShortTextFormatter(commit.Message), SlackTextFormatter(commit.Author.Name))
attachmentText += fmt.Sprintf("%s: %s - %s", SlackLinkFormatter(commit.URL, commit.ID[:7]), SlackEncloseTitle(SlackShortTextFormatter(commit.Message)), SlackEncloseAuthor(SlackTextFormatter(commit.Author.Name)))
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
attachmentText += "\n"
Expand All @@ -150,7 +168,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) *SlackPayload {
func getSlackIssuesPayload(p *api.IssuesPayload, slack *SlackMeta) *SlackPayload {
senderLink := SlackLinkFormatter(conf.Server.ExternalURL+p.Sender.UserName, p.Sender.UserName)
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Index),
fmt.Sprintf("#%d %s", p.Index, p.Issue.Title))
fmt.Sprintf("#%d %s", p.Index, SlackEncloseTitle(p.Issue.Title)))
var text, title, attachmentText string
switch p.Action {
case api.HOOK_ISSUE_OPENED:
Expand Down Expand Up @@ -196,7 +214,7 @@ func getSlackIssuesPayload(p *api.IssuesPayload, slack *SlackMeta) *SlackPayload
func getSlackIssueCommentPayload(p *api.IssueCommentPayload, slack *SlackMeta) *SlackPayload {
senderLink := SlackLinkFormatter(conf.Server.ExternalURL+p.Sender.UserName, p.Sender.UserName)
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID)),
fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title))
fmt.Sprintf("#%d %s", p.Issue.Index, SlackEncloseTitle(p.Issue.Title)))
var text, title, attachmentText string
switch p.Action {
case api.HOOK_ISSUE_COMMENT_CREATED:
Expand All @@ -210,7 +228,7 @@ func getSlackIssueCommentPayload(p *api.IssueCommentPayload, slack *SlackMeta) *
case api.HOOK_ISSUE_COMMENT_DELETED:
text = fmt.Sprintf("[%s] Comment deleted by %s", p.Repository.FullName, senderLink)
title = SlackLinkFormatter(fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index),
fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title))
fmt.Sprintf("#%d %s", p.Issue.Index, SlackEncloseTitle(p.Issue.Title)))
attachmentText = SlackTextFormatter(p.Comment.Body)
}

Expand All @@ -230,7 +248,7 @@ func getSlackIssueCommentPayload(p *api.IssueCommentPayload, slack *SlackMeta) *
func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) *SlackPayload {
senderLink := SlackLinkFormatter(conf.Server.ExternalURL+p.Sender.UserName, p.Sender.UserName)
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index),
fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title))
fmt.Sprintf("#%d %s", p.Index, SlackEncloseTitle(p.PullRequest.Title)))
var text, title, attachmentText string
switch p.Action {
case api.HOOK_ISSUE_OPENED:
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/gogs/gogs/pull/7282/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy