Skip to content

Commit

Permalink
Merge branch 'release/v1.21' into lunny/update-container-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
GiteaBot authored Feb 24, 2024
2 parents 94dd2f6 + 35db5a3 commit 5bea3ee
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ email_title = Email Settings
smtp_addr = SMTP Host
smtp_port = SMTP Port
smtp_from = Send Email As
smtp_from_invalid = The "Send Email As" address is invalid
smtp_from_helper = Email address Gitea will use. Enter a plain email address or use the "Name" <email@example.com> format.
mailer_user = SMTP Username
mailer_password = SMTP Password
Expand Down
6 changes: 6 additions & 0 deletions routers/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package install
import (
"fmt"
"net/http"
"net/mail"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -417,6 +418,11 @@ func SubmitInstall(ctx *context.Context) {
}

if len(strings.TrimSpace(form.SMTPAddr)) > 0 {
if _, err := mail.ParseAddress(form.SMTPFrom); err != nil {
ctx.RenderWithErr(ctx.Tr("install.smtp_from_invalid"), tplInstall, &form)
return
}

cfg.Section("mailer").Key("ENABLED").SetValue("true")
cfg.Section("mailer").Key("SMTP_ADDR").SetValue(form.SMTPAddr)
cfg.Section("mailer").Key("SMTP_PORT").SetValue(form.SMTPPort)
Expand Down
17 changes: 17 additions & 0 deletions routers/web/shared/user/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package user
import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization"
project_model "code.gitea.io/gitea/models/project"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
Expand Down Expand Up @@ -125,5 +126,21 @@ func LoadHeaderCount(ctx *context.Context) error {
}
ctx.Data["RepoCount"] = repoCount

var projectType project_model.Type
if ctx.ContextUser.IsOrganization() {
projectType = project_model.TypeOrganization
} else {
projectType = project_model.TypeIndividual
}
projectCount, err := project_model.CountProjects(ctx, project_model.SearchOptions{
OwnerID: ctx.ContextUser.ID,
IsClosed: util.OptionalBoolOf(false),
Type: projectType,
})
if err != nil {
return err
}
ctx.Data["ProjectCount"] = projectCount

return nil
}
3 changes: 3 additions & 0 deletions templates/org/menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
{{if .CanReadProjects}}
<a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects">
{{svg "octicon-project-symlink"}} {{ctx.Locale.Tr "user.projects"}}
{{if .ProjectCount}}
<div class="ui small label">{{.ProjectCount}}</div>
{{end}}
</a>
{{end}}
{{if and .IsPackageEnabled .CanReadPackages}}
Expand Down
3 changes: 3 additions & 0 deletions templates/user/overview/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
{{if or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadProjects)}}
<a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item">
{{svg "octicon-project-symlink"}} {{ctx.Locale.Tr "user.projects"}}
{{if .ProjectCount}}
<div class="ui small label">{{.ProjectCount}}</div>
{{end}}
</a>
{{end}}
{{if and .IsPackageEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadPackages))}}
Expand Down

0 comments on commit 5bea3ee

Please sign in to comment.