Skip to content

Commit 6ffdffa

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Prevent duplicate actions email (go-gitea#35215) rename nightly docker tag for main branch (go-gitea#35344) Fix atom/rss mixed error (go-gitea#35345) Remove deprecated auth sources (go-gitea#35272) Always return the relevant status information, even if no status exists. (go-gitea#35335) [skip ci] Updated translations via Crowdin Upgrade mermaid from 11.9.0 to 11.10.0 (go-gitea#35329) Use configurable remote name for git commands (go-gitea#35172)
2 parents 7e1e001 + c7b99c8 commit 6ffdffa

File tree

22 files changed

+655
-130
lines changed

22 files changed

+655
-130
lines changed

.github/workflows/release-nightly.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ jobs:
7575
- name: Get cleaned branch name
7676
id: clean_name
7777
run: |
78-
# if main then say nightly otherwise cleanup name
79-
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
80-
echo "branch=nightly" >> "$GITHUB_OUTPUT"
81-
exit 0
82-
fi
8378
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
8479
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
8580
- name: Login to Docker Hub
@@ -122,11 +117,6 @@ jobs:
122117
- name: Get cleaned branch name
123118
id: clean_name
124119
run: |
125-
# if main then say nightly otherwise cleanup name
126-
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
127-
echo "branch=nightly" >> "$GITHUB_OUTPUT"
128-
exit 0
129-
fi
130120
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
131121
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
132122
- name: Login to Docker Hub

modules/setting/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func DefaultOpenWithEditorApps() OpenWithEditorAppsType {
4949

5050
type RepositoryStruct struct {
5151
OpenWithEditorApps *config.Value[OpenWithEditorAppsType]
52+
GitGuideRemoteName *config.Value[string]
5253
}
5354

5455
type ConfigStruct struct {
@@ -70,6 +71,7 @@ func initDefaultConfig() {
7071
},
7172
Repository: &RepositoryStruct{
7273
OpenWithEditorApps: config.ValueJSON[OpenWithEditorAppsType]("repository.open-with.editor-apps"),
74+
GitGuideRemoteName: config.ValueJSON[string]("repository.git-guide-remote-name").WithDefault("origin"),
7375
},
7476
}
7577
}

modules/setting/config/value.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (value *Value[T]) Value(ctx context.Context) (v T) {
4646

4747
rev := dg.GetRevision(ctx)
4848

49-
// if the revision in database doesn't change, use the last value
49+
// if the revision in the database doesn't change, use the last value
5050
value.mu.RLock()
5151
if rev == value.revision {
5252
v = value.value
@@ -84,6 +84,10 @@ func (value *Value[T]) WithDefault(def T) *Value[T] {
8484
return value
8585
}
8686

87+
func (value *Value[T]) DefaultValue() T {
88+
return value.def
89+
}
90+
8791
func (value *Value[T]) WithFileConfig(cfgSecKey CfgSecKey) *Value[T] {
8892
value.cfgSecKey = cfgSecKey
8993
return value

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,6 +3425,7 @@ config.picture_service = Picture Service
34253425
config.disable_gravatar = Disable Gravatar
34263426
config.enable_federated_avatar = Enable Federated Avatars
34273427
config.open_with_editor_app_help = The "Open with" editors for the clone menu. If left empty, the default will be used. Expand to see the default.
3428+
config.git_guide_remote_name = Repository remote name for git commands in the guide
34283429
34293430
config.git_config = Git Configuration
34303431
config.git_disable_diff_highlight = Disable Diff Syntax Highlight

options/locale/locale_pt-PT.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ error404=A página que pretende aceder <strong>não existe</strong> ou <strong>n
120120
error503=O servidor não conseguiu concluir o seu pedido. Tente novamente mais tarde.
121121
go_back=Voltar
122122
invalid_data=Dados inválidos: %v
123+
nothing_has_been_changed=Nada foi alterado.
123124

124125
never=Nunca
125126
unknown=Desconhecido
@@ -2843,6 +2844,11 @@ settings.location=Localização
28432844
settings.permission=Permissões
28442845
settings.repoadminchangeteam=O administrador do repositório pode adicionar e remover o acesso às equipas
28452846
settings.visibility=Visibilidade
2847+
settings.change_visibility=Alterar visibilidade
2848+
settings.change_visibility_notices_1=Se a organização for convertida em privada, a contagem de favoritos do repositório será eliminada e não poderá ser restaurada.
2849+
settings.change_visibility_notices_2=Os não-membros irão perder acesso aos repositórios da organização se a visibilidade for mudada para privada.
2850+
settings.change_visibility_success=A visibilidade da organização %s foi mudada com sucesso.
2851+
settings.visibility_desc=Mudar quem pode ver a organização e os seus repositórios.
28462852
settings.visibility.public=Público
28472853
settings.visibility.limited=Limitada (visível apenas para utilizadores autenticados)
28482854
settings.visibility.limited_shortname=Limitada
@@ -3419,6 +3425,7 @@ config.picture_service=Serviço de imagem
34193425
config.disable_gravatar=Desabilitar o Gravatar
34203426
config.enable_federated_avatar=Habilitar avatares federados
34213427
config.open_with_editor_app_help=Os editores de "Abrir com" do menu de clonagem. Se for deixado em branco, será usado o predefinido. Expanda para ver o predefinido.
3428+
config.git_guide_remote_name=Nome remoto do repositório para os comandos git no guia
34223429

34233430
config.git_config=Configuração Git
34243431
config.git_disable_diff_highlight=Desabilitar o realce de sintaxe no diff

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"jquery": "3.7.1",
3434
"katex": "0.16.22",
3535
"license-checker-webpack-plugin": "0.2.1",
36-
"mermaid": "11.9.0",
36+
"mermaid": "11.10.0",
3737
"mini-css-extract-plugin": "2.9.2",
3838
"minimatch": "10.0.3",
3939
"monaco-editor": "0.52.2",

routers/api/v1/repo/status.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,7 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
271271
}
272272
ctx.SetTotalCountHeader(count)
273273

274-
if len(statuses) == 0 {
275-
ctx.JSON(http.StatusOK, &api.CombinedStatus{})
276-
return
277-
}
278-
279-
combiStatus := convert.ToCombinedStatus(ctx, statuses, convert.ToRepo(ctx, repo, ctx.Repo.Permission))
274+
combiStatus := convert.ToCombinedStatus(ctx, refCommit.Commit.ID.String(), statuses,
275+
convert.ToRepo(ctx, repo, ctx.Repo.Permission))
280276
ctx.JSON(http.StatusOK, combiStatus)
281277
}

routers/web/admin/auths.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func NewAuthSource(ctx *context.Context) {
9797
ctx.Data["AuthSources"] = authSources
9898
ctx.Data["SecurityProtocols"] = securityProtocols
9999
ctx.Data["SMTPAuths"] = smtp.Authenticators
100-
oauth2providers := oauth2.GetSupportedOAuth2Providers()
100+
oauth2providers := oauth2.GetSupportedOAuth2ProvidersWithContext(ctx)
101101
ctx.Data["OAuth2Providers"] = oauth2providers
102102

103103
ctx.Data["SSPIAutoCreateUsers"] = true
@@ -107,7 +107,9 @@ func NewAuthSource(ctx *context.Context) {
107107
ctx.Data["SSPIDefaultLanguage"] = ""
108108

109109
// only the first as default
110-
ctx.Data["oauth2_provider"] = oauth2providers[0].Name()
110+
if len(oauth2providers) > 0 {
111+
ctx.Data["oauth2_provider"] = oauth2providers[0].Name()
112+
}
111113

112114
ctx.HTML(http.StatusOK, tplAuthNew)
113115
}
@@ -240,7 +242,7 @@ func NewAuthSourcePost(ctx *context.Context) {
240242
ctx.Data["AuthSources"] = authSources
241243
ctx.Data["SecurityProtocols"] = securityProtocols
242244
ctx.Data["SMTPAuths"] = smtp.Authenticators
243-
oauth2providers := oauth2.GetSupportedOAuth2Providers()
245+
oauth2providers := oauth2.GetSupportedOAuth2ProvidersWithContext(ctx)
244246
ctx.Data["OAuth2Providers"] = oauth2providers
245247

246248
ctx.Data["SSPIAutoCreateUsers"] = true

routers/web/admin/config.go

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,21 @@ func ConfigSettings(ctx *context.Context) {
196196
}
197197

198198
func ChangeConfig(ctx *context.Context) {
199-
key := strings.TrimSpace(ctx.FormString("key"))
200-
value := ctx.FormString("value")
201199
cfg := setting.Config()
202200

203-
marshalBool := func(v string) (string, error) { //nolint:unparam // error is always nil
204-
if b, _ := strconv.ParseBool(v); b {
205-
return "true", nil
201+
marshalBool := func(v string) ([]byte, error) {
202+
b, _ := strconv.ParseBool(v)
203+
return json.Marshal(b)
204+
}
205+
206+
marshalString := func(emptyDefault string) func(v string) ([]byte, error) {
207+
return func(v string) ([]byte, error) {
208+
return json.Marshal(util.IfZero(v, emptyDefault))
206209
}
207-
return "false", nil
208210
}
209-
marshalOpenWithApps := func(value string) (string, error) {
211+
212+
marshalOpenWithApps := func(value string) ([]byte, error) {
213+
// TODO: move the block alongside OpenWithEditorAppsType.ToTextareaString
210214
lines := strings.Split(value, "\n")
211215
var openWithEditorApps setting.OpenWithEditorAppsType
212216
for _, line := range lines {
@@ -224,32 +228,47 @@ func ChangeConfig(ctx *context.Context) {
224228
OpenURL: strings.TrimSpace(openURL),
225229
})
226230
}
227-
b, err := json.Marshal(openWithEditorApps)
228-
if err != nil {
229-
return "", err
230-
}
231-
return string(b), nil
231+
return json.Marshal(openWithEditorApps)
232232
}
233-
marshallers := map[string]func(string) (string, error){
233+
marshallers := map[string]func(string) ([]byte, error){
234234
cfg.Picture.DisableGravatar.DynKey(): marshalBool,
235235
cfg.Picture.EnableFederatedAvatar.DynKey(): marshalBool,
236236
cfg.Repository.OpenWithEditorApps.DynKey(): marshalOpenWithApps,
237+
cfg.Repository.GitGuideRemoteName.DynKey(): marshalString(cfg.Repository.GitGuideRemoteName.DefaultValue()),
237238
}
238-
marshaller, hasMarshaller := marshallers[key]
239-
if !hasMarshaller {
240-
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
241-
return
239+
240+
_ = ctx.Req.ParseForm()
241+
configKeys := ctx.Req.Form["key"]
242+
configValues := ctx.Req.Form["value"]
243+
configSettings := map[string]string{}
244+
loop:
245+
for i, key := range configKeys {
246+
if i >= len(configValues) {
247+
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
248+
break loop
249+
}
250+
value := configValues[i]
251+
252+
marshaller, hasMarshaller := marshallers[key]
253+
if !hasMarshaller {
254+
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
255+
break loop
256+
}
257+
258+
marshaledValue, err := marshaller(value)
259+
if err != nil {
260+
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
261+
break loop
262+
}
263+
configSettings[key] = string(marshaledValue)
242264
}
243-
marshaledValue, err := marshaller(value)
244-
if err != nil {
245-
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
265+
if ctx.Written() {
246266
return
247267
}
248-
if err = system_model.SetSettings(ctx, map[string]string{key: marshaledValue}); err != nil {
249-
ctx.JSONError(ctx.Tr("admin.config.set_setting_failed", key))
268+
if err := system_model.SetSettings(ctx, configSettings); err != nil {
269+
ctx.ServerError("SetSettings", err)
250270
return
251271
}
252-
253272
config.GetDynGetter().InvalidateCache()
254273
ctx.JSONOK()
255274
}

0 commit comments

Comments
 (0)