Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  Simplify the code to get issue count (go-gitea#19380)
  use IsLoopback (go-gitea#19477)
  [skip ci] Updated translations via Crowdin
  Add RSS Feed buttons to Repo, User and Org pages (go-gitea#19370)
  [doctor] authorized-keys: fix displayed check name (go-gitea#19464)
  [skip ci] Updated translations via Crowdin
  Use horizontal tabs for repo header on mobile (go-gitea#19468)
  • Loading branch information
zjjhot committed Apr 25, 2022
2 parents 4c3d09a + fc00286 commit 59edd92
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 42 deletions.
12 changes: 1 addition & 11 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1510,20 +1510,10 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
func CountIssues(opts *IssuesOptions) (int64, error) {
e := db.GetEngine(db.DefaultContext)

countsSlice := make([]*struct {
Count int64
}, 0, 1)

sess := e.Select("COUNT(issue.id) AS count").Table("issue")
sess.Join("INNER", "repository", "`issue`.repo_id = `repository`.id")
opts.setupSessionNoLimit(sess)
if err := sess.Find(&countsSlice); err != nil {
return 0, fmt.Errorf("unable to CountIssues: %w", err)
}
if len(countsSlice) != 1 {
return 0, fmt.Errorf("unable to get one row result when CountIssues, row count=%d", len(countsSlice))
}
return countsSlice[0].Count, nil
return sess.Count()
}

// GetParticipantsIDsByIssueID returns the IDs of all users who participated in comments of an issue,
Expand Down
4 changes: 2 additions & 2 deletions modules/doctor/authorizedkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func checkAuthorizedKeys(ctx context.Context, logger log.Logger, autofix bool) e
"authorized_keys file %q is out of date.\nRegenerate it with:\n\t\"%s\"\nor\n\t\"%s\"",
fPath,
"gitea admin regenerate keys",
"gitea doctor --run authorized_keys --fix")
return fmt.Errorf(`authorized_keys is out of date and should be regenerated with "gitea admin regenerate keys" or "gitea doctor --run authorized_keys --fix"`)
"gitea doctor --run authorized-keys --fix")
return fmt.Errorf(`authorized_keys is out of date and should be regenerated with "gitea admin regenerate keys" or "gitea doctor --run authorized-keys --fix"`)
}
logger.Warn("authorized_keys is out of date. Attempting rewrite...")
err = asymkey_model.RewriteAllPublicKeys()
Expand Down
24 changes: 1 addition & 23 deletions modules/validation/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,10 @@ import (
"code.gitea.io/gitea/modules/setting"
)

var loopbackIPBlocks []*net.IPNet

var externalTrackerRegex = regexp.MustCompile(`({?)(?:user|repo|index)+?(}?)`)

func init() {
for _, cidr := range []string{
"127.0.0.0/8", // IPv4 loopback
"::1/128", // IPv6 loopback
} {
if _, block, err := net.ParseCIDR(cidr); err == nil {
loopbackIPBlocks = append(loopbackIPBlocks, block)
}
}
}

func isLoopbackIP(ip string) bool {
pip := net.ParseIP(ip)
if pip == nil {
return false
}
for _, block := range loopbackIPBlocks {
if block.Contains(pip) {
return true
}
}
return false
return net.ParseIP(ip).IsLoopback()
}

// IsValidURL checks if URL is valid
Expand Down
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ error404 = The page you are trying to reach either <strong>does not exist</stron

never = Never

rss_feed = RSS Feed

[error]
occurred = An error occurred
report_message = If you are sure this is a Gitea bug, please search for issues on <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> or open a new issue if necessary.
Expand Down
3 changes: 3 additions & 0 deletions options/locale/locale_ja-JP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,9 @@ container.labels.key=キー
container.labels.value=値
generic.download=コマンドラインでパッケージをダウンロードします:
generic.documentation=汎用 レジストリの詳細については、<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/generic">ドキュメント</a> を参照してください。
helm.registry=このレジストリをコマンドラインからセットアップします:
helm.install=パッケージをインストールするには、次のコマンドを実行します:
helm.documentation=Helm レジストリの詳細については、 <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/helm/">ドキュメント</a> を参照してください。
maven.registry=あなたのプロジェクトの <code>pom.xml</code> ファイルに、このレジストリをセットアップします:
maven.install=パッケージを使用するため <code>pom.xml</code> ファイル内の <code>dependencies</code> ブロックに以下を含めます:
maven.install2=コマンドラインで実行します:
Expand Down
7 changes: 7 additions & 0 deletions options/locale/locale_pt-BR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ organizations=Organizações
search=Pesquisar
code=Código
search.fuzzy=Similar
search.match=Correspondência
code_search_unavailable=A pesquisa por código não está disponível no momento. Entre em contato com o administrador do site.
repo_no_results=Nenhum repositório correspondente foi encontrado.
user_no_results=Nenhum usuário correspondente foi encontrado.
Expand Down Expand Up @@ -566,6 +567,7 @@ comment_type_group_lock=Status de Bloqueio
comment_type_group_review_request=Revisar solicitação
comment_type_group_pull_request_push=Commits adicionados
comment_type_group_project=Projeto
comment_type_group_issue_ref=Referência do issue
saved_successfully=Suas configurações foram salvas com sucesso.
privacy=Privacidade
keep_activity_private=Ocultar a atividade da página de perfil
Expand Down Expand Up @@ -2987,6 +2989,8 @@ empty.documentation=Para obter mais informações sobre o registro de pacote, co
filter.type=Tipo
filter.type.all=Todos
filter.no_result=Seu filtro não produziu resultados.
filter.container.tagged=Marcado
filter.container.untagged=Desmarcado
published_by=Publicado %[1]s por <a href="%[2]s">%[3]s</a>
published_by_in=Publicado %[1]s por <a href="%[2]s">%[3]s</a> em <a href="%[4]s"><strong>%[5]s</strong></a>
installation=Instalação
Expand All @@ -2998,6 +3002,7 @@ details=Detalhes
details.author=Autor
details.project_site=Site do Projeto
details.license=Licença
assets=Recursos
versions=Versões
versions.on=em
versions.view_all=Ver todas
Expand All @@ -3019,6 +3024,7 @@ container.details.documentation_site=Site da Documentação
container.pull=Puxe a imagem pela linha de comando:
container.documentation=Para obter mais informações sobre o registro de Container, consulte <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/container/">a documentação</a>.
container.multi_arch=S.O. / Arquitetura
container.layers=Camadas da Imagem
container.labels=Rótulos
container.labels.key=Chave
container.labels.value=Valor
Expand All @@ -3041,6 +3047,7 @@ npm.install2=ou adicione-o ao arquivo package.json:
npm.documentation=Para obter mais informações sobre o registro npm, consulte <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/npm/">a documentação</a>.
npm.dependencies=Dependências
npm.dependencies.development=Dependências de Desenvolvimento
npm.dependencies.peer=Dependências Peer
npm.dependencies.optional=Dependências Opcionais
npm.details.tag=Tag
pypi.requires=Requer Python
Expand Down
1 change: 1 addition & 0 deletions templates/org/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div id="org-info">
<div class="ui header">
{{.Org.DisplayName}}
<a href="{{.Org.HomeLink}}.rss"><i class="ui grey icon tooltip ml-3" data-content="{{.i18n.Tr "rss_feed"}}" data-position="top center">{{svg "octicon-rss" 36}}</i></a>
<span class="org-visibility">
{{if .Org.Visibility.IsLimited}}<div class="ui large basic horizontal label">{{.i18n.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .Org.Visibility.IsPrivate}}<div class="ui large basic horizontal label">{{.i18n.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
Expand Down
3 changes: 2 additions & 1 deletion templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
<div class="mx-2">/</div>
<a href="{{$.RepoLink}}">{{.Name}}</a>
<a href="{{$.RepoLink}}.rss"><i class="ui grey icon tooltip ml-3" data-content="{{$.i18n.Tr "rss_feed"}}" data-position="top center">{{svg "octicon-rss" 18}}</i></a>
<div class="labels df ac fw">
{{if .IsTemplate}}
{{if .IsPrivate}}
Expand Down Expand Up @@ -144,7 +145,7 @@
</div><!-- end grid -->
</div><!-- end container -->
{{end}}
<div class="ui tabs container">
<div class="ui tabs container repo-header-container">
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
<div class="ui tabular stackable menu navbar">
{{if .Permission.CanRead $.UnitTypeCode}}
Expand Down
1 change: 1 addition & 0 deletions templates/user/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<div class="content word-break profile-avatar-name">
{{if .Owner.FullName}}<span class="header text center">{{.Owner.FullName}}</span>{{end}}
<span class="username text center">{{.Owner.Name}}</span>
<a href="{{.Owner.HomeLink}}.rss"><i class="ui grey icon tooltip ml-3" data-content="{{.i18n.Tr "rss_feed"}}" data-position="bottom center">{{svg "octicon-rss" 18}}</i></a>
</div>
<div class="extra content word-break">
<ul>
Expand Down
2 changes: 2 additions & 0 deletions web_src/less/_organization.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
overflow-wrap: anywhere;

.ui.header {
display: flex;
align-items: center;
font-size: 36px;
margin-bottom: 0;
.org-visibility .label {
Expand Down
25 changes: 25 additions & 0 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -2956,11 +2956,21 @@ tbody.commit-list {
justify-content: space-between;
flex-wrap: wrap;
word-break: break-word;

@media @mediaSm {
+ .container {
margin-top: 7px;
}
}
}

.repo-buttons {
display: flex;
align-items: center;

@media @mediaSm {
margin-top: 1em;
}
}

.repo-buttons .ui.labeled.button > .label:hover {
Expand Down Expand Up @@ -3227,3 +3237,18 @@ td.blob-excerpt {
transform: scale(105%);
box-shadow: 0 .5rem 1rem var(--color-shadow) !important;
}

@media @mediaSm {
.repo-header-container {
overflow-x: auto;
overflow-y: hidden;

.ui.stackable.menu {
flex-direction: row;

.item {
width: initial !important;
}
}
}
}
7 changes: 2 additions & 5 deletions web_src/less/_user.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
.user {
&.profile {
.ui.card {
.header,
.username {
display: block;
}

.header {
display: block;
font-weight: 600;
font-size: 1.3rem;
margin-top: -.2rem;
Expand All @@ -17,6 +13,7 @@

.profile-avatar-name {
border-top: none;
text-align: center;
}

.extra.content {
Expand Down

0 comments on commit 59edd92

Please sign in to comment.