From d59a48a2550abd4129b96d38473941b895a4859b Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 2 Nov 2016 18:18:04 +0100 Subject: [PATCH 1/3] Use proper url for libravatar dep --- .gopmfile | 2 +- glide.lock | 2 +- glide.yaml | 2 +- modules/setting/setting.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gopmfile b/.gopmfile index 0b1b7cc52e..604038b666 100644 --- a/.gopmfile +++ b/.gopmfile @@ -35,7 +35,7 @@ github.com/nfnt/resize = commit:891127d github.com/russross/blackfriday = commit:93622da github.com/satori/go.uuid = commit:0aa62d5 github.com/sergi/go-diff = commit:ec7fdbb -github.com/strk/go-libravatar = commit:5eed7bf +strk.kbt.io/projects/go/libravatar = commit:5eed7bf github.com/shurcooL/sanitized_anchor_name = commit:10ef21a github.com/Unknwon/cae = commit:7f5e046 github.com/Unknwon/com = commit:28b053d diff --git a/glide.lock b/glide.lock index 0d280df273..e31fc6d651 100644 --- a/glide.lock +++ b/glide.lock @@ -81,7 +81,7 @@ imports: version: ec7fdbb58eb3e300c8595ad5ac74a5aa50019cc7 subpackages: - diffmatchpatch -- name: github.com/strk/go-libravatar +- name: strk.kbt.io/projects/go/libravatar version: 5eed7bff870ae19ef51c5773dbc8f3e9fcbd0982 - name: github.com/shurcooL/sanitized_anchor_name version: 10ef21a441db47d8b13ebcc5fd2310f636973c77 diff --git a/glide.yaml b/glide.yaml index 1d4734eb55..e761d9c2d9 100644 --- a/glide.yaml +++ b/glide.yaml @@ -40,7 +40,7 @@ import: - package: github.com/sergi/go-diff subpackages: - diffmatchpatch -- package: github.com/strk/go-libravatar +- package: strk.kbt.io/projects/go/libravatar - package: golang.org/x/crypto subpackages: - ssh diff --git a/modules/setting/setting.go b/modules/setting/setting.go index cff3e7dbc2..b3a932e91c 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -21,7 +21,7 @@ import ( _ "github.com/go-macaron/cache/redis" "github.com/go-macaron/session" _ "github.com/go-macaron/session/redis" - "github.com/strk/go-libravatar" + "strk.kbt.io/projects/go/libravatar" "gopkg.in/ini.v1" "github.com/gogits/gogs/modules/bindata" From af03d00780a6ee70c58e135c6679542cde4f8d50 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 7 Sep 2016 11:19:44 +0200 Subject: [PATCH 2/3] Fix sender of issue notifications It is the FROM field in mailer configuration that needs be used, not the USER field, which is for authentication. Closes https://github.com/gogits/gogs/issues/3615 --- models/mail.go | 2 +- modules/setting/setting.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/models/mail.go b/models/mail.go index 0db21355a8..85f1560b44 100644 --- a/models/mail.go +++ b/models/mail.go @@ -160,7 +160,7 @@ func composeIssueMessage(issue *Issue, doer *User, tplName base.TplName, tos []s if err != nil { log.Error(3, "HTMLString (%s): %v", tplName, err) } - msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.User), subject, content) + msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.FromEmail), subject, content) msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info) return msg } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index b3a932e91c..7696c09127 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -6,6 +6,7 @@ package setting import ( "fmt" + "net/mail" "net/url" "os" "os/exec" @@ -714,6 +715,7 @@ type Mailer struct { Name string Host string From string + FromEmail string User, Passwd string DisableHelo bool HeloHostname string @@ -749,6 +751,13 @@ func newMailService() { EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(), } MailService.From = sec.Key("FROM").MustString(MailService.User) + + parsed, err := mail.ParseAddress(MailService.From) + if err != nil { + log.Fatal(4, "Invalid mailer.FROM (%s): %v", MailService.From, err) + } + MailService.FromEmail = parsed.Address + log.Info("Mail Service Enabled") } From 060d10a4cb6ce5247af1b2f8dec6bf99718d8ec2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 3 Nov 2016 14:41:13 +0800 Subject: [PATCH 3/3] config lgtm to disable maintainer to LGTM himself's PR --- .lgtm | 1 + 1 file changed, 1 insertion(+) create mode 100644 .lgtm diff --git a/.lgtm b/.lgtm new file mode 100644 index 0000000000..79f20258f9 --- /dev/null +++ b/.lgtm @@ -0,0 +1 @@ +self_approval_off = false