Skip to content

Commit f3aed8a

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Actions Artifacts v4 backend (go-gitea#28965) Remove jQuery AJAX from common global functions (go-gitea#29528) Allow options to disable user gpg keys configuration from the interface on app.ini (go-gitea#29486) [skip ci] Updated translations via Crowdin Fix issue & comment history bugs (go-gitea#29525) Fix incorrect diff expander for deletion of last lines in a file (go-gitea#29501) Ignore `__debug_bin*` which is generated by vscode when debugging (go-gitea#29524)
2 parents 2095f08 + a53d268 commit f3aed8a

File tree

25 files changed

+2101
-50
lines changed

25 files changed

+2101
-50
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ _test
1515

1616
# MS VSCode
1717
.vscode
18-
__debug_bin
18+
__debug_bin*
1919

2020
*.cgo1.go
2121
*.cgo2.c

custom/conf/app.example.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,9 @@ LEVEL = Info
14801480
;;
14811481
;; Default configuration for email notifications for users (user configurable). Options: enabled, onmention, disabled
14821482
;DEFAULT_EMAIL_NOTIFICATIONS = enabled
1483-
;; Disabled features for users, could be "deletion", more features can be disabled in future
1483+
;; Disabled features for users, could be "deletion","manage_gpg_keys" more features can be disabled in future
14841484
;; - deletion: a user cannot delete their own account
1485+
;; - manage_gpg_keys: a user cannot configure gpg keys
14851486
;USER_DISABLED_FEATURES =
14861487

14871488
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,9 @@ And the following unique queues:
518518

519519
- `DEFAULT_EMAIL_NOTIFICATIONS`: **enabled**: Default configuration for email notifications for users (user configurable). Options: enabled, onmention, disabled
520520
- `DISABLE_REGULAR_ORG_CREATION`: **false**: Disallow regular (non-admin) users from creating organizations.
521-
- `USER_DISABLED_FEATURES`: **_empty_** Disabled features for users, could be `deletion` and more features can be added in future.
521+
- `USER_DISABLED_FEATURES`: **_empty_** Disabled features for users, could be `deletion`, `manage_gpg_keys` and more features can be added in future.
522522
- `deletion`: User cannot delete their own account.
523+
- `manage_gpg_keys`: User cannot configure gpg keys
523524

524525
## Security (`security`)
525526

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,9 @@ Gitea 创建以下非唯一队列:
497497

498498
- `DEFAULT_EMAIL_NOTIFICATIONS`: **enabled**:用户电子邮件通知的默认配置(用户可配置)。选项:enabled、onmention、disabled
499499
- `DISABLE_REGULAR_ORG_CREATION`: **false**:禁止普通(非管理员)用户创建组织。
500-
- `USER_DISABLED_FEATURES`:**_empty_** 禁用的用户特性,当前允许为空或者 `deletion`, 未来可以增加更多设置。
500+
- `USER_DISABLED_FEATURES`:**_empty_** 禁用的用户特性,当前允许为空或者 `deletion``manage_gpg_keys` 未来可以增加更多设置。
501501
- `deletion`: 用户不能通过界面或者API删除他自己。
502+
- `manage_gpg_keys`: 用户不能配置 GPG 密钥
502503

503504
## 安全性 (`security`)
504505

models/fixtures/action_run.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,22 @@
1717
updated: 1683636626
1818
need_approval: 0
1919
approved_by: 0
20+
-
21+
id: 792
22+
title: "update actions"
23+
repo_id: 4
24+
owner_id: 1
25+
workflow_id: "artifact.yaml"
26+
index: 188
27+
trigger_user_id: 1
28+
ref: "refs/heads/master"
29+
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
30+
event: "push"
31+
is_fork_pull_request: 0
32+
status: 1
33+
started: 1683636528
34+
stopped: 1683636626
35+
created: 1683636108
36+
updated: 1683636626
37+
need_approval: 0
38+
approved_by: 0

models/fixtures/action_run_job.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,17 @@
1212
status: 1
1313
started: 1683636528
1414
stopped: 1683636626
15+
-
16+
id: 193
17+
run_id: 792
18+
repo_id: 4
19+
owner_id: 1
20+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
21+
is_fork_pull_request: 0
22+
name: job_2
23+
attempt: 1
24+
job_id: job_2
25+
task_id: 48
26+
status: 1
27+
started: 1683636528
28+
stopped: 1683636626

models/fixtures/action_task.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,23 @@
1818
log_length: 707
1919
log_size: 90179
2020
log_expired: 0
21+
-
22+
id: 48
23+
job_id: 193
24+
attempt: 1
25+
runner_id: 1
26+
status: 6 # 6 is the status code for "running", running task can upload artifacts
27+
started: 1683636528
28+
stopped: 1683636626
29+
repo_id: 4
30+
owner_id: 1
31+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
32+
is_fork_pull_request: 0
33+
token_hash: ffffcfffffffbffffffffffffffffefffffffafffffffffffffffffffffffffffffdffffffffffffffffffffffffffffffff
34+
token_salt: ffffffffff
35+
token_last_eight: ffffffff
36+
log_filename: artifact-test2/2f/47.log
37+
log_in_storage: 1
38+
log_length: 707
39+
log_size: 90179
40+
log_expired: 0

models/issues/content_history.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,9 @@ func FetchIssueContentHistoryList(dbCtx context.Context, issueID, commentID int6
172172

173173
// HasIssueContentHistory check if a ContentHistory entry exists
174174
func HasIssueContentHistory(dbCtx context.Context, issueID, commentID int64) (bool, error) {
175-
exists, err := db.GetEngine(dbCtx).Cols("id").Exist(&ContentHistory{
176-
IssueID: issueID,
177-
CommentID: commentID,
178-
})
175+
exists, err := db.GetEngine(dbCtx).Where(builder.Eq{"issue_id": issueID, "comment_id": commentID}).Exist(&ContentHistory{})
179176
if err != nil {
180-
log.Error("can not fetch issue content history. err=%v", err)
181-
return false, err
177+
return false, fmt.Errorf("can not check issue content history. err: %w", err)
182178
}
183179
return exists, err
184180
}

models/issues/content_history_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,22 @@ func TestContentHistory(t *testing.T) {
7878
assert.EqualValues(t, 7, list2[1].HistoryID)
7979
assert.EqualValues(t, 4, list2[2].HistoryID)
8080
}
81+
82+
func TestHasIssueContentHistoryForCommentOnly(t *testing.T) {
83+
assert.NoError(t, unittest.PrepareTestDatabase())
84+
85+
_ = db.TruncateBeans(db.DefaultContext, &issues_model.ContentHistory{})
86+
87+
hasHistory1, _ := issues_model.HasIssueContentHistory(db.DefaultContext, 10, 0)
88+
assert.False(t, hasHistory1)
89+
hasHistory2, _ := issues_model.HasIssueContentHistory(db.DefaultContext, 10, 100)
90+
assert.False(t, hasHistory2)
91+
92+
_ = issues_model.SaveIssueContentHistory(db.DefaultContext, 1, 10, 100, timeutil.TimeStampNow(), "c-a", true)
93+
_ = issues_model.SaveIssueContentHistory(db.DefaultContext, 1, 10, 100, timeutil.TimeStampNow().Add(5), "c-b", false)
94+
95+
hasHistory1, _ = issues_model.HasIssueContentHistory(db.DefaultContext, 10, 0)
96+
assert.False(t, hasHistory1)
97+
hasHistory2, _ = issues_model.HasIssueContentHistory(db.DefaultContext, 10, 100)
98+
assert.True(t, hasHistory2)
99+
}

modules/setting/admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ func loadAdminFrom(rootCfg ConfigProvider) {
2020
}
2121

2222
const (
23-
UserFeatureDeletion = "deletion"
23+
UserFeatureDeletion = "deletion"
24+
UserFeatureManageGPGKeys = "manage_gpg_keys"
2425
)

options/locale/locale_fr-FR.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ authorization_failed_desc=L'autorisation a échoué car nous avons détecté une
424424
sspi_auth_failed=Échec de l'authentification SSPI
425425
password_pwned=Le mot de passe que vous avez choisi se trouve sur la liste <a target="_blank" rel="noopener noreferrer" href="https://haveibeenpwned.com/Passwords">des mots de passe ayant fuité</a> sur internet. Veuillez réessayer avec un mot de passe différent et considérer remplacer ce mot de passe si vous l'utilisez ailleurs.
426426
password_pwned_err=Impossible d'envoyer la demande à HaveIBeenPwned
427+
last_admin=Vous ne pouvez pas supprimer ce compte car au moins un administrateur est requis.
427428

428429
[mail]
429430
view_it_on=Voir sur %s
@@ -1714,6 +1715,7 @@ pulls.select_commit_hold_shift_for_range=Maintenir Maj et cliquer sur des révis
17141715
pulls.review_only_possible_for_full_diff=Une évaluation n'est possible que lorsque vous affichez le différentiel complet.
17151716
pulls.filter_changes_by_commit=Filtrer par révision
17161717
pulls.nothing_to_compare=Ces branches sont identiques. Il n’y a pas besoin de créer une demande d'ajout.
1718+
pulls.nothing_to_compare_have_tag=Les branches/étiquettes sélectionnées sont équivalentes.
17171719
pulls.nothing_to_compare_and_allow_empty_pr=Ces branches sont égales. Cette demande d'ajout sera vide.
17181720
pulls.has_pull_request='Il existe déjà une demande d'ajout entre ces deux branches : <a href="%[1]s">%[2]s#%[3]d</a>'
17191721
pulls.create=Créer une demande d'ajout

0 commit comments

Comments
 (0)