Browse Source

Minor fix for #2660

pull/2706/head
Unknwon 9 years ago
parent
commit
baaf6046a1
  1. 2
      README.md
  2. 2
      cmd/web.go
  3. 4
      conf/locale/locale_en-US.ini
  4. 2
      gogs.go
  5. 1086
      modules/bindata/bindata.go
  6. 7
      modules/mailer/mail.go
  7. 3
      public/css/gogs.css
  8. 6
      public/less/_admin.less
  9. 11
      routers/admin/admin.go
  10. 2
      templates/.VERSION
  11. 13
      templates/admin/config.tmpl

2
README.md

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current version: 0.8.43 ##### Current version: 0.8.44
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

2
cmd/web.go

@ -250,7 +250,7 @@ func runWeb(ctx *cli.Context) {
m.Group("/admin", func() { m.Group("/admin", func() {
m.Get("", adminReq, admin.Dashboard) m.Get("", adminReq, admin.Dashboard)
m.Get("/config", admin.Config) m.Get("/config", admin.Config)
m.Get("/config/testmailer", admin.TestMailer) m.Post("/config/test_mail", admin.SendTestMail)
m.Get("/monitor", admin.Monitor) m.Get("/monitor", admin.Monitor)
m.Group("/users", func() { m.Group("/users", func() {

4
conf/locale/locale_en-US.ini

@ -989,7 +989,9 @@ config.mailer_disable_helo = Disable HELO
config.mailer_name = Name config.mailer_name = Name
config.mailer_host = Host config.mailer_host = Host
config.mailer_user = User config.mailer_user = User
config.mailer_test_email = Test Email Settings config.send_test_mail = Send Test Email
config.test_mail_failed = Fail to send test email to '%s': %v
config.test_mail_sent = Test email has been sent to '%s'.
config.oauth_config = OAuth Configuration config.oauth_config = OAuth Configuration
config.oauth_enabled = Enabled config.oauth_enabled = Enabled
config.cache_config = Cache Configuration config.cache_config = Cache Configuration

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.8.43.0223" const APP_VER = "0.8.44.0224"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

1086
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

7
modules/mailer/mail.go

@ -9,6 +9,7 @@ import (
"path" "path"
"strings" "strings"
"gopkg.in/gomail.v2"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogits/gogs/models"
@ -184,8 +185,6 @@ func SendCollaboratorMail(r macaron.Render, u, doer *models.User, repo *models.R
return nil return nil
} }
func SendTestMail(u *models.User) { func SendTestMail(email string) error {
msg := NewMessage([]string{u.Email}, "Gogs Test Email!", "Gogs Test Email!") return gomail.Send(&Sender{}, NewMessage([]string{email}, "Gogs Test Email!", "Gogs Test Email!").Message)
SendAsync(msg)
} }

3
public/css/gogs.css

@ -2551,6 +2551,9 @@ footer .container .links > *:first-child {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.admin.config #test-mail-btn {
margin-left: 5px;
}
.explore { .explore {
padding-top: 15px; padding-top: 15px;
padding-bottom: 80px; padding-bottom: 80px;

6
public/less/_admin.less

@ -57,4 +57,10 @@
white-space: nowrap; white-space: nowrap;
} }
} }
&.config {
#test-mail-btn {
margin-left: 5px;
}
}
} }

11
routers/admin/admin.go

@ -175,9 +175,14 @@ func Dashboard(ctx *middleware.Context) {
ctx.HTML(200, DASHBOARD) ctx.HTML(200, DASHBOARD)
} }
func TestMailer(ctx *middleware.Context) { func SendTestMail(ctx *middleware.Context) {
// send a test email to the user's email address and redirect back to Config email := ctx.Query("email")
mailer.SendTestMail(ctx.User) // Send a test email to the user's email address and redirect back to Config
if err := mailer.SendTestMail(email); err != nil {
ctx.Flash.Error(ctx.Tr("admin.config.test_mail_failed", email, err))
} else {
ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email))
}
ctx.Redirect(setting.AppSubUrl + "/admin/config") ctx.Redirect(setting.AppSubUrl + "/admin/config")
} }

2
templates/.VERSION

@ -1 +1 @@
0.8.43.0223 0.8.44.0224

13
templates/admin/config.tmpl

@ -1,5 +1,5 @@
{{template "base/head" .}} {{template "base/head" .}}
<div class="admin monitor"> <div class="admin config">
<div class="ui container"> <div class="ui container">
<div class="ui grid"> <div class="ui grid">
{{template "admin/navbar" .}} {{template "admin/navbar" .}}
@ -117,7 +117,16 @@
<dd>{{.Mailer.Host}}</dd> <dd>{{.Mailer.Host}}</dd>
<dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt> <dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt>
<dd>{{.Mailer.User}}</dd><br> <dd>{{.Mailer.User}}</dd><br>
<a class="ui green button" tabindex="5" href="/admin/config/testmailer">{{.i18n.Tr "admin.config.mailer_test_email"}}</a>{{end}} <form class="ui form" action="{{AppSubUrl}}/admin/config/test_mail" method="post">
{{.CsrfTokenHtml}}
<div class="inline field ui left">
<div class="ui input">
<input type="email" name="email" required>
</div>
</div>
<button class="ui green button" id="test-mail-btn">{{.i18n.Tr "admin.config.send_test_mail"}}</button>
</form>
{{end}}
</dl> </dl>
</div> </div>

Loading…
Cancel
Save