Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport translations and fixes from main to 1.23 #32868

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/actions/run_job_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestAggregateJobStatus(t *testing.T) {
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},

// skipped with other status
// TODO: need to clarify whether a PR with "skipped" job status is considered as "mergeable" or not.
// "all skipped" is also considered as "mergeable" by "services/actions.toCommitStatus", the same as GitHub
{[]Status{StatusSkipped}, StatusSkipped},
{[]Status{StatusSkipped, StatusSuccess}, StatusSuccess},
{[]Status{StatusSkipped, StatusFailure}, StatusFailure},
Expand Down
3 changes: 2 additions & 1 deletion modules/markup/markdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func SpecializedMarkdown(ctx *markup.RenderContext) *GlodmarkRender {
Enabled: setting.Markdown.EnableMath,
ParseDollarInline: true,
ParseDollarBlock: true,
ParseSquareBlock: true, // TODO: this is a bad syntax, it should be deprecated in the future (by some config options)
ParseSquareBlock: true, // TODO: this is a bad syntax "\[ ... \]", it conflicts with normal markdown escaping, it should be deprecated in the future (by some config options)
// ParseBracketInline: true, // TODO: this is also a bad syntax "\( ... \)", it also conflicts, it should be deprecated in the future
}),
meta.Meta,
),
Expand Down
3 changes: 3 additions & 0 deletions modules/repository/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
"code.gitea.io/gitea/modules/setting"
)

// CanUserForkBetweenOwners returns true if user can fork between owners.
// By default, a user can fork a repository from another owner, but not from themselves.
// Many users really like to fork their own repositories, so add an experimental setting to allow this.
func CanUserForkBetweenOwners(id1, id2 int64) bool {
if id1 != id2 {
return true
Expand Down
1 change: 0 additions & 1 deletion options/locale/locale_fr-FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,6 @@ issues.timetracker_timer_stop=Arrêter le minuteur
issues.timetracker_timer_discard=Annuler le minuteur
issues.timetracker_timer_manually_add=Pointer du temps

issues.time_estimate_placeholder=1h 2m
issues.time_estimate_set=Définir le temps estimé
issues.time_estimate_display=Estimation : %s
issues.change_time_estimate_at=a changé le temps estimé à <b>%s</b> %s
Expand Down
1 change: 0 additions & 1 deletion options/locale/locale_ga-IE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,6 @@ issues.timetracker_timer_stop=Stop an t-amadóir
issues.timetracker_timer_discard=Déan an t-amadóir a scriosadh
issues.timetracker_timer_manually_add=Cuir Am leis

issues.time_estimate_placeholder=1u 2n
issues.time_estimate_set=Socraigh am measta
issues.time_estimate_display=Meastachán: %s
issues.change_time_estimate_at=d'athraigh an meastachán ama go <b>%s</b> %s
Expand Down
2 changes: 1 addition & 1 deletion options/locale/locale_pt-PT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,6 @@ issues.timetracker_timer_stop=Parar cronómetro
issues.timetracker_timer_discard=Descartar cronómetro
issues.timetracker_timer_manually_add=Adicionar tempo

issues.time_estimate_placeholder=1h 2m
issues.time_estimate_set=Definir tempo estimado
issues.time_estimate_display=Estimativa: %s
issues.change_time_estimate_at=alterou a estimativa de tempo para <b>%s</b> %s
Expand Down Expand Up @@ -2632,6 +2631,7 @@ release.new_release=Novo lançamento
release.draft=Rascunho
release.prerelease=Pré-lançamento
release.stable=Estável
release.latest=Mais recente
release.compare=Comparar
release.edit=editar
release.ahead.commits=<strong>%d</strong> cometimentos
Expand Down
171 changes: 170 additions & 1 deletion options/locale/locale_zh-CN.ini

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions routers/web/repo/actions/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,11 @@ func ViewPost(ctx *context_module.Context) {
}
}

// TODO: "ComposeMetas" (usually for comment) is not quite right, but it is still the same as what template "RenderCommitMessage" does.
// need to be refactored together in the future
metas := ctx.Repo.Repository.ComposeMetas(ctx)

// the title for the "run" is from the commit message
resp.State.Run.Title = run.Title
resp.State.Run.TitleHTML = templates.NewRenderUtils(ctx).RenderCommitMessage(run.Title, metas)
resp.State.Run.Link = run.Link()
Expand Down
6 changes: 6 additions & 0 deletions services/auth/source/ldap/source_authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models/auth"
user_model "code.gitea.io/gitea/models/user"
auth_module "code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/optional"
asymkey_service "code.gitea.io/gitea/services/asymkey"
source_service "code.gitea.io/gitea/services/auth/source"
Expand All @@ -31,7 +32,12 @@ func (source *Source) Authenticate(ctx context.Context, user *user_model.User, u
return nil, user_model.ErrUserNotExist{Name: loginName}
}
// Fallback.
// FIXME: this fallback would cause problems when the "Username" attribute is not set and a user inputs their email.
// In this case, the email would be used as the username, and will cause the "CreateUser" failure for the first login.
if sr.Username == "" {
if strings.Contains(userName, "@") {
log.Error("No username in search result (Username Attribute is not set properly?), using email as username might cause problems")
}
sr.Username = userName
}
if sr.Mail == "" {
Expand Down
3 changes: 2 additions & 1 deletion templates/package/content/container.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
</thead>
<tbody>
{{range .PackageDescriptor.Metadata.Manifests}}
{{/* "unknown/unknown" is attestation-manifest, so we should skip it */}}
{{if ne .Platform "unknown/unknown"}}
<tr>
<td><a href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{StringUtils.TrimPrefix .Digest "sha256:" | ShortSha}}</a></td>
<td><a class="tw-font-mono" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{StringUtils.TrimPrefix .Digest "sha256:" | ShortSha}}</a></td>
<td>{{.Platform}}</td>
<td>{{FileSize .Size}}</td>
</tr>
Expand Down
4 changes: 3 additions & 1 deletion templates/repo/commit_page.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@
<p id="cherry-pick-content" class="branch-dropdown"></p>

<form method="get">
{{/*FIXME: CurrentRefShortName seems not making sense here (old code),
because the "commit page" has no "$.BranchName" info, so only using DefaultBranch should be enough */}}
{{template "repo/branch_dropdown" dict
"Repository" .Repository
"ShowTabBranches" true
"CurrentRefType" "branch"
"CurrentRefShortName" (Iif $.BranchName $.Repository.DefaultBranch)
"CurrentRefShortName" (or $.BranchName $.Repository.DefaultBranch)
"RefFormActionTemplate" (print "{RepoLink}/_cherrypick/" .CommitID "/{RefShortName}")
}}
<input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br>
Expand Down
3 changes: 3 additions & 0 deletions templates/repo/issue/filter_item_label.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<div class="divider"></div>
<a class="item label-filter-query-default" href="{{QueryBuild $queryLink "labels" NIL}}">{{ctx.Locale.Tr "repo.issues.filter_label_no_select"}}</a>
<a class="item label-filter-query-not-set" href="{{QueryBuild $queryLink "labels" 0}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a>
{{/* The logic here is not the same as the label selector in the issue sidebar.
The one in the issue sidebar renders "repo labels | divider | org labels".
Maybe the logic should be updated to be consistent.*/}}
{{$previousExclusiveScope := "_no_scope"}}
{{range .Labels}}
{{$exclusiveScope := .ExclusiveScope}}
Expand Down
1 change: 1 addition & 0 deletions templates/user/auth/signin_inner.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
</div>
</form>
{{end}}{{/*if .EnablePasswordSignInForm*/}}
{{/* "oauth_container" contains not only "oauth2" methods, but also "OIDC" and "SSPI" methods */}}
{{$showOAuth2Methods := or .OAuth2Providers .EnableOpenIDSignIn .EnableSSPI}}
{{if and $showOAuth2Methods .EnablePasswordSignInForm}}
<div class="divider divider-text">{{ctx.Locale.Tr "sign_in_or"}}</div>
Expand Down
2 changes: 2 additions & 0 deletions templates/user/auth/signup_inner.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
</button>
</div>
{{end}}
{{/* "oauth_container" contains not only "oauth2" methods, but also "OIDC" and "SSPI" methods */}}
{{/* TODO: it seems that "EnableSSPI" is only set in "sign-in" handlers, but it should use the same logic to control its display */}}
{{$showOAuth2Methods := or .OAuth2Providers .EnableOpenIDSignIn .EnableSSPI}}
{{if $showOAuth2Methods}}
<div class="divider divider-text">{{ctx.Locale.Tr "sign_in_or"}}</div>
Expand Down
2 changes: 2 additions & 0 deletions templates/user/dashboard/issues.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
{{template "repo/issue/filter_item_label" dict "Labels" .Labels "QueryLink" $queryLinkWithFilter "SupportArchivedLabel" true}}
{{end}}

{{/* at the moment there is no easy way to get poster candidates on this page, so only show a username input, search for what the end user enters */}}
{{if ne $.ViewType "created_by"}}
{{template "repo/issue/filter_item_user_fetch" dict
"QueryParamKey" "poster"
Expand All @@ -70,6 +71,7 @@
}}
{{end}}

{{/* at the moment there is no easy way to get assignee candidates on this page, so only show a username input, search for what the end user enters */}}
{{if ne $.ViewType "assigned"}}
{{template "repo/issue/filter_item_user_fetch" dict
"QueryParamKey" "assignee"
Expand Down
10 changes: 10 additions & 0 deletions web_src/js/components/RepoBranchTagSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ const sfc = {
if (this.menuVisible) this.menuVisible = false;
});
},

mounted() {
if (this.refFormActionTemplate) {
// if the selector is used in a form and needs to change the form action,
// make a mock item and select it to update the form action
const item: ListItem = {selected: true, refType: this.currentRefType, refShortName: this.currentRefShortName, rssFeedLink: ''};
this.selectItem(item);
}
},

methods: {
selectItem(item: ListItem) {
this.menuVisible = false;
Expand Down
Loading