From cde6cc02666f7c63f7f6da316dd7dbaebc326f36 Mon Sep 17 00:00:00 2001 From: Pablo Ovelleiro Corral Date: Tue, 23 Apr 2019 22:25:46 +0200 Subject: [PATCH] added blank files for tests --- listener.go | 6 +++--- testdata/gitea_postdata/html/fork | 0 testdata/gitea_postdata/html/issue_comment_created | 0 testdata/gitea_postdata/html/issue_comment_deleted | 0 testdata/gitea_postdata/html/issues_assigned | 0 testdata/gitea_postdata/html/issues_closed | 0 testdata/gitea_postdata/html/issues_demilestoned | 0 testdata/gitea_postdata/html/issues_edited | 0 testdata/gitea_postdata/html/issues_label_cleared | 0 testdata/gitea_postdata/html/issues_label_updated | 0 testdata/gitea_postdata/html/issues_milestoned | 0 testdata/gitea_postdata/html/issues_opened | 0 testdata/gitea_postdata/html/issues_reopened | 0 testdata/gitea_postdata/html/issues_synchronized | 0 testdata/gitea_postdata/html/issues_unassigned | 0 testdata/gitea_postdata/html/pull_request_approved | 0 testdata/gitea_postdata/html/pull_request_assigned | 0 testdata/gitea_postdata/html/pull_request_closed | 0 testdata/gitea_postdata/html/pull_request_comment | 0 testdata/gitea_postdata/html/pull_request_demilestoned | 0 testdata/gitea_postdata/html/pull_request_edited | 0 testdata/gitea_postdata/html/pull_request_label_cleared | 0 testdata/gitea_postdata/html/pull_request_label_updated | 0 testdata/gitea_postdata/html/pull_request_milestoned | 0 testdata/gitea_postdata/html/pull_request_opened | 0 testdata/gitea_postdata/html/pull_request_rejected | 0 testdata/gitea_postdata/html/pull_request_reopened | 0 testdata/gitea_postdata/html/pull_request_synchronized | 0 testdata/gitea_postdata/html/pull_request_unassigned | 0 testdata/gitea_postdata/html/push | 0 testdata/gitea_postdata/html/release_deleted | 0 testdata/gitea_postdata/html/release_published | 0 testdata/gitea_postdata/html/release_updated | 0 testdata/gitea_postdata/html/repository_created | 0 testdata/gitea_postdata/html/repository_deleted | 0 testdata/gitea_postdata/text/fork | 0 testdata/gitea_postdata/text/issue_comment_created | 0 testdata/gitea_postdata/text/issue_comment_deleted | 0 testdata/gitea_postdata/text/issues_assigned | 0 testdata/gitea_postdata/text/issues_closed | 0 testdata/gitea_postdata/text/issues_demilestoned | 0 testdata/gitea_postdata/text/issues_edited | 0 testdata/gitea_postdata/text/issues_label_cleared | 0 testdata/gitea_postdata/text/issues_label_updated | 0 testdata/gitea_postdata/text/issues_milestoned | 0 testdata/gitea_postdata/text/issues_opened | 0 testdata/gitea_postdata/text/issues_reopened | 0 testdata/gitea_postdata/text/issues_synchronized | 0 testdata/gitea_postdata/text/issues_unassigned | 0 testdata/gitea_postdata/text/pull_request_approved | 0 testdata/gitea_postdata/text/pull_request_assigned | 0 testdata/gitea_postdata/text/pull_request_closed | 0 testdata/gitea_postdata/text/pull_request_comment | 0 testdata/gitea_postdata/text/pull_request_demilestoned | 0 testdata/gitea_postdata/text/pull_request_edited | 0 testdata/gitea_postdata/text/pull_request_label_cleared | 0 testdata/gitea_postdata/text/pull_request_label_updated | 0 testdata/gitea_postdata/text/pull_request_milestoned | 0 testdata/gitea_postdata/text/pull_request_opened | 0 testdata/gitea_postdata/text/pull_request_rejected | 0 testdata/gitea_postdata/text/pull_request_reopened | 0 testdata/gitea_postdata/text/pull_request_synchronized | 0 testdata/gitea_postdata/text/pull_request_unassigned | 0 testdata/gitea_postdata/text/push | 0 testdata/gitea_postdata/text/release_deleted | 0 testdata/gitea_postdata/text/release_published | 0 testdata/gitea_postdata/text/release_updated | 0 testdata/gitea_postdata/text/repository_created | 0 testdata/gitea_postdata/text/repository_deleted | 0 69 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 testdata/gitea_postdata/html/fork create mode 100644 testdata/gitea_postdata/html/issue_comment_created create mode 100644 testdata/gitea_postdata/html/issue_comment_deleted create mode 100644 testdata/gitea_postdata/html/issues_assigned create mode 100644 testdata/gitea_postdata/html/issues_closed create mode 100644 testdata/gitea_postdata/html/issues_demilestoned create mode 100644 testdata/gitea_postdata/html/issues_edited create mode 100644 testdata/gitea_postdata/html/issues_label_cleared create mode 100644 testdata/gitea_postdata/html/issues_label_updated create mode 100644 testdata/gitea_postdata/html/issues_milestoned create mode 100644 testdata/gitea_postdata/html/issues_opened create mode 100644 testdata/gitea_postdata/html/issues_reopened create mode 100644 testdata/gitea_postdata/html/issues_synchronized create mode 100644 testdata/gitea_postdata/html/issues_unassigned create mode 100644 testdata/gitea_postdata/html/pull_request_approved create mode 100644 testdata/gitea_postdata/html/pull_request_assigned create mode 100644 testdata/gitea_postdata/html/pull_request_closed create mode 100644 testdata/gitea_postdata/html/pull_request_comment create mode 100644 testdata/gitea_postdata/html/pull_request_demilestoned create mode 100644 testdata/gitea_postdata/html/pull_request_edited create mode 100644 testdata/gitea_postdata/html/pull_request_label_cleared create mode 100644 testdata/gitea_postdata/html/pull_request_label_updated create mode 100644 testdata/gitea_postdata/html/pull_request_milestoned create mode 100644 testdata/gitea_postdata/html/pull_request_opened create mode 100644 testdata/gitea_postdata/html/pull_request_rejected create mode 100644 testdata/gitea_postdata/html/pull_request_reopened create mode 100644 testdata/gitea_postdata/html/pull_request_synchronized create mode 100644 testdata/gitea_postdata/html/pull_request_unassigned create mode 100644 testdata/gitea_postdata/html/push create mode 100644 testdata/gitea_postdata/html/release_deleted create mode 100644 testdata/gitea_postdata/html/release_published create mode 100644 testdata/gitea_postdata/html/release_updated create mode 100644 testdata/gitea_postdata/html/repository_created create mode 100644 testdata/gitea_postdata/html/repository_deleted create mode 100644 testdata/gitea_postdata/text/fork create mode 100644 testdata/gitea_postdata/text/issue_comment_created create mode 100644 testdata/gitea_postdata/text/issue_comment_deleted create mode 100644 testdata/gitea_postdata/text/issues_assigned create mode 100644 testdata/gitea_postdata/text/issues_closed create mode 100644 testdata/gitea_postdata/text/issues_demilestoned create mode 100644 testdata/gitea_postdata/text/issues_edited create mode 100644 testdata/gitea_postdata/text/issues_label_cleared create mode 100644 testdata/gitea_postdata/text/issues_label_updated create mode 100644 testdata/gitea_postdata/text/issues_milestoned create mode 100644 testdata/gitea_postdata/text/issues_opened create mode 100644 testdata/gitea_postdata/text/issues_reopened create mode 100644 testdata/gitea_postdata/text/issues_synchronized create mode 100644 testdata/gitea_postdata/text/issues_unassigned create mode 100644 testdata/gitea_postdata/text/pull_request_approved create mode 100644 testdata/gitea_postdata/text/pull_request_assigned create mode 100644 testdata/gitea_postdata/text/pull_request_closed create mode 100644 testdata/gitea_postdata/text/pull_request_comment create mode 100644 testdata/gitea_postdata/text/pull_request_demilestoned create mode 100644 testdata/gitea_postdata/text/pull_request_edited create mode 100644 testdata/gitea_postdata/text/pull_request_label_cleared create mode 100644 testdata/gitea_postdata/text/pull_request_label_updated create mode 100644 testdata/gitea_postdata/text/pull_request_milestoned create mode 100644 testdata/gitea_postdata/text/pull_request_opened create mode 100644 testdata/gitea_postdata/text/pull_request_rejected create mode 100644 testdata/gitea_postdata/text/pull_request_reopened create mode 100644 testdata/gitea_postdata/text/pull_request_synchronized create mode 100644 testdata/gitea_postdata/text/pull_request_unassigned create mode 100644 testdata/gitea_postdata/text/push create mode 100644 testdata/gitea_postdata/text/release_deleted create mode 100644 testdata/gitea_postdata/text/release_published create mode 100644 testdata/gitea_postdata/text/release_updated create mode 100644 testdata/gitea_postdata/text/repository_created create mode 100644 testdata/gitea_postdata/text/repository_deleted diff --git a/listener.go b/listener.go index e154946..ef2aa3f 100644 --- a/listener.go +++ b/listener.go @@ -55,14 +55,14 @@ func PostHandler(w http.ResponseWriter, r *http.Request) { messageText, err := generateTextMessage(postData, r.Header.Get("X-Gitea-Event")) if err != nil { log.Warning(err) - log.Warning(postData) + log.Warningf("%s", body) } switch msgType { case "html": messageHTML, err := generateHTMLMessage(postData, r.Header.Get("X-Gitea-Event")) if err != nil { log.Warning(err) - log.Warning(postData) + log.Warningf("%s", body) } mygiteabot.SendHTMLToRoom(room, messageHTML, messageText) case "plain": @@ -177,7 +177,7 @@ func generateTextMessage(data GiteaPostData, eventHeader string) (string, error) var tpl bytes.Buffer mesgTemplates := map[string]string{ - "push": "[{{.Repository.Fullname}}] {{.Pusher.FullName}} pushed " + strconv.Itoa(len(data.Commits)) + " commit(s) to {{.Repository.Name}}", + "push": "[{{.Repository.Fullname}}]: {{.Pusher.FullName}} pushed " + strconv.Itoa(len(data.Commits)) + " commit(s) to {{.Repository.Name}}", "issues.assigned": "[{{.Repository.FullName}}]: {{.Sender.FullName}} assigned issue #{{.Issue.Number}} {{.Issue.Title}} to {{}}", "issues.closed": "[{{.Repository.FullName}}]: {{.Sender.FullName}} closed issue #{{.Issue.Number}} {{.Issue.Title}}", "issues.demilestoned": "[{{.Repository.FullName}}]: {{.Sender.FullName}} removed milestone TODO from issue #{{.Issue.Number}} {{.Issue.Title}}", diff --git a/testdata/gitea_postdata/html/fork b/testdata/gitea_postdata/html/fork new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issue_comment_created b/testdata/gitea_postdata/html/issue_comment_created new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issue_comment_deleted b/testdata/gitea_postdata/html/issue_comment_deleted new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_assigned b/testdata/gitea_postdata/html/issues_assigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_closed b/testdata/gitea_postdata/html/issues_closed new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_demilestoned b/testdata/gitea_postdata/html/issues_demilestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_edited b/testdata/gitea_postdata/html/issues_edited new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_label_cleared b/testdata/gitea_postdata/html/issues_label_cleared new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_label_updated b/testdata/gitea_postdata/html/issues_label_updated new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_milestoned b/testdata/gitea_postdata/html/issues_milestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_opened b/testdata/gitea_postdata/html/issues_opened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_reopened b/testdata/gitea_postdata/html/issues_reopened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_synchronized b/testdata/gitea_postdata/html/issues_synchronized new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/issues_unassigned b/testdata/gitea_postdata/html/issues_unassigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_approved b/testdata/gitea_postdata/html/pull_request_approved new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_assigned b/testdata/gitea_postdata/html/pull_request_assigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_closed b/testdata/gitea_postdata/html/pull_request_closed new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_comment b/testdata/gitea_postdata/html/pull_request_comment new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_demilestoned b/testdata/gitea_postdata/html/pull_request_demilestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_edited b/testdata/gitea_postdata/html/pull_request_edited new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_label_cleared b/testdata/gitea_postdata/html/pull_request_label_cleared new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_label_updated b/testdata/gitea_postdata/html/pull_request_label_updated new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_milestoned b/testdata/gitea_postdata/html/pull_request_milestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_opened b/testdata/gitea_postdata/html/pull_request_opened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_rejected b/testdata/gitea_postdata/html/pull_request_rejected new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_reopened b/testdata/gitea_postdata/html/pull_request_reopened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_synchronized b/testdata/gitea_postdata/html/pull_request_synchronized new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/pull_request_unassigned b/testdata/gitea_postdata/html/pull_request_unassigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/push b/testdata/gitea_postdata/html/push new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/release_deleted b/testdata/gitea_postdata/html/release_deleted new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/release_published b/testdata/gitea_postdata/html/release_published new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/release_updated b/testdata/gitea_postdata/html/release_updated new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/repository_created b/testdata/gitea_postdata/html/repository_created new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/html/repository_deleted b/testdata/gitea_postdata/html/repository_deleted new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/fork b/testdata/gitea_postdata/text/fork new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issue_comment_created b/testdata/gitea_postdata/text/issue_comment_created new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issue_comment_deleted b/testdata/gitea_postdata/text/issue_comment_deleted new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_assigned b/testdata/gitea_postdata/text/issues_assigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_closed b/testdata/gitea_postdata/text/issues_closed new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_demilestoned b/testdata/gitea_postdata/text/issues_demilestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_edited b/testdata/gitea_postdata/text/issues_edited new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_label_cleared b/testdata/gitea_postdata/text/issues_label_cleared new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_label_updated b/testdata/gitea_postdata/text/issues_label_updated new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_milestoned b/testdata/gitea_postdata/text/issues_milestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_opened b/testdata/gitea_postdata/text/issues_opened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_reopened b/testdata/gitea_postdata/text/issues_reopened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_synchronized b/testdata/gitea_postdata/text/issues_synchronized new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/issues_unassigned b/testdata/gitea_postdata/text/issues_unassigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_approved b/testdata/gitea_postdata/text/pull_request_approved new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_assigned b/testdata/gitea_postdata/text/pull_request_assigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_closed b/testdata/gitea_postdata/text/pull_request_closed new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_comment b/testdata/gitea_postdata/text/pull_request_comment new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_demilestoned b/testdata/gitea_postdata/text/pull_request_demilestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_edited b/testdata/gitea_postdata/text/pull_request_edited new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_label_cleared b/testdata/gitea_postdata/text/pull_request_label_cleared new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_label_updated b/testdata/gitea_postdata/text/pull_request_label_updated new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_milestoned b/testdata/gitea_postdata/text/pull_request_milestoned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_opened b/testdata/gitea_postdata/text/pull_request_opened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_rejected b/testdata/gitea_postdata/text/pull_request_rejected new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_reopened b/testdata/gitea_postdata/text/pull_request_reopened new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_synchronized b/testdata/gitea_postdata/text/pull_request_synchronized new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/pull_request_unassigned b/testdata/gitea_postdata/text/pull_request_unassigned new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/push b/testdata/gitea_postdata/text/push new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/release_deleted b/testdata/gitea_postdata/text/release_deleted new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/release_published b/testdata/gitea_postdata/text/release_published new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/release_updated b/testdata/gitea_postdata/text/release_updated new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/repository_created b/testdata/gitea_postdata/text/repository_created new file mode 100644 index 0000000..e69de29 diff --git a/testdata/gitea_postdata/text/repository_deleted b/testdata/gitea_postdata/text/repository_deleted new file mode 100644 index 0000000..e69de29