Skip to content

Commit 23fb584

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Adjust changelog for v1.21.6 to move prs to correct labels (go-gitea#29339) (go-gitea#29343) Allow options to disable user deletion from the interface on app.ini (go-gitea#29275)
2 parents d1e6961 + 7d0903b commit 23fb584

File tree

7 files changed

+44
-24
lines changed

7 files changed

+44
-24
lines changed

CHANGELOG.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ been added to each release, please refer to the [blog](https://blog.gitea.com).
99
* SECURITY
1010
* Fix XSS vulnerabilities (#29336)
1111
* Use general token signing secret (#29205) (#29325)
12-
* API
13-
* Refactor issue template parsing and fix API endpoint (#29069) (#29140)
14-
* Fix swift packages not resolving (#29095) (#29102)
1512
* ENHANCEMENTS
1613
* Refactor git version functions and check compatibility (#29155) (#29157)
1714
* Improve user experience for outdated comments (#29050) (#29086)
1815
* Hide code links on release page if user cannot read code (#29064) (#29066)
1916
* Wrap contained tags and branches again (#29021) (#29026)
2017
* Fix incorrect button CSS usages (#29015) (#29023)
2118
* Strip trailing newline in markdown code copy (#29019) (#29022)
19+
* Implement some action notifier functions (#29173) (#29308)
20+
* Load outdated comments when (un)resolving conversation on PR timeline (#29203) (#29221)
2221
* BUGFIXES
22+
* Refactor issue template parsing and fix API endpoint (#29069) (#29140)
23+
* Fix swift packages not resolving (#29095) (#29102)
2324
* Remove SSH workaround (#27893) (#29332)
2425
* Only log error when tag sync fails (#29295) (#29327)
2526
* Fix SSPI user creation (#28948) (#29323)
@@ -44,18 +45,15 @@ been added to each release, please refer to the [blog](https://blog.gitea.com).
4445
* Avoid showing unnecessary JS errors when there are elements with different origin on the page (#29081) (#29089)
4546
* Fix gitea-origin-url with default ports (#29085) (#29088)
4647
* Fix orgmode link resolving (#29024) (#29076)
47-
* Fix: Elasticsearch: Request Entity Too Large #28117 (#29062) (#29075)
48+
* Fix Elasticsearh Request Entity Too Large #28117 (#29062) (#29075)
4849
* Do not render empty comments (#29039) (#29049)
4950
* Avoid sending update/delete release notice when it is draft (#29008) (#29025)
50-
* DOCS
51-
* Rm outdated docs from some languages (#27530) (#29208)
52-
* MISC
53-
* Implement some action notifier functions (#29173) (#29308)
5451
* Fix gitea-action user avatar broken on edited menu (#29190) (#29307)
5552
* Disallow merge when required checked are missing (#29143) (#29268)
56-
* Convert visibility to number (#29226) (#29244)
57-
* Load outdated comments when (un)resolving conversation on PR timeline (#29203) (#29221)
5853
* Fix incorrect link to swift doc and swift package-registry login command (#29096) (#29103)
54+
* Convert visibility to number (#29226) (#29244)
55+
* DOCS
56+
* Remove outdated docs from some languages (#27530) (#29208)
5957
* Fix typos in the documentation (#29048) (#29056)
6058
* Explained where create issue/PR template (#29035)
6159

@@ -174,7 +172,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.com).
174172
* Fix Chinese translation of config cheat sheet[API] (#28472) (#28473)
175173
* Retry SSH key verification with additional CRLF if it failed (#28392) (#28464)
176174

177-
## [1.21.2](https://github.com/go-gitea/gitea/releases/tag/1.21.2) - 2023-12-12
175+
## [1.21.2](https://github.com/go-gitea/gitea/releases/tag/v1.21.2) - 2023-12-12
178176

179177
* SECURITY
180178
* Rebuild with recently released golang version
@@ -213,7 +211,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.com).
213211
* Use full width for project boards (#28225) (#28245)
214212
* Enable system users search via the API (#28013) (#28018)
215213

216-
## [1.21.1](https://github.com/go-gitea/gitea/releases/tag/1.21.1) - 2023-11-26
214+
## [1.21.1](https://github.com/go-gitea/gitea/releases/tag/v1.21.1) - 2023-11-26
217215

218216
* SECURITY
219217
* Fix comment permissions (#28213) (#28216)

custom/conf/app.example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,9 @@ LEVEL = Info
14741474
;;
14751475
;; Default configuration for email notifications for users (user configurable). Options: enabled, onmention, disabled
14761476
;DEFAULT_EMAIL_NOTIFICATIONS = enabled
1477+
;; Disabled features for users, could be "deletion", more features can be disabled in future
1478+
;; - deletion: a user cannot delete their own account
1479+
;USER_DISABLED_FEATURES =
14771480

14781481
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14791482
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ 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.
522+
- `deletion`: User cannot delete their own account.
521523

522524
## Security (`security`)
523525

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

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

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

501503
## 安全性 (`security`)
502504

modules/setting/admin.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33

44
package setting
55

6+
import "code.gitea.io/gitea/modules/container"
7+
68
// Admin settings
79
var Admin struct {
810
DisableRegularOrgCreation bool
911
DefaultEmailNotification string
12+
UserDisabledFeatures container.Set[string]
1013
}
1114

1215
func loadAdminFrom(rootCfg ConfigProvider) {
13-
mustMapSetting(rootCfg, "admin", &Admin)
1416
sec := rootCfg.Section("admin")
17+
Admin.DisableRegularOrgCreation = sec.Key("DISABLE_REGULAR_ORG_CREATION").MustBool(false)
1518
Admin.DefaultEmailNotification = sec.Key("DEFAULT_EMAIL_NOTIFICATIONS").MustString("enabled")
19+
Admin.UserDisabledFeatures = container.SetOf(sec.Key("USER_DISABLED_FEATURES").Strings(",")...)
1620
}
21+
22+
const (
23+
UserFeatureDeletion = "deletion"
24+
)

routers/web/user/setting/account.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ func DeleteEmail(ctx *context.Context) {
233233

234234
// DeleteAccount render user suicide page and response for delete user himself
235235
func DeleteAccount(ctx *context.Context) {
236+
if setting.Admin.UserDisabledFeatures.Contains(setting.UserFeatureDeletion) {
237+
ctx.Error(http.StatusNotFound)
238+
return
239+
}
240+
236241
ctx.Data["Title"] = ctx.Tr("settings")
237242
ctx.Data["PageIsSettingsAccount"] = true
238243

@@ -299,6 +304,7 @@ func loadAccountData(ctx *context.Context) {
299304
ctx.Data["EmailNotificationsPreference"] = ctx.Doer.EmailNotificationsPreference
300305
ctx.Data["ActivationsPending"] = pendingActivation
301306
ctx.Data["CanAddEmails"] = !pendingActivation || !setting.Service.RegisterEmailConfirm
307+
ctx.Data["UserDisabledFeatures"] = &setting.Admin.UserDisabledFeatures
302308

303309
if setting.Service.UserDeleteWithCommentsMaxTime != 0 {
304310
ctx.Data["UserDeleteWithCommentsMaxTime"] = setting.Service.UserDeleteWithCommentsMaxTime.String()

templates/user/settings/account.tmpl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
{{end}}
129129
</div>
130130

131+
{{if not ($.UserDisabledFeatures.Contains "deletion")}}
131132
<h4 class="ui top attached error header">
132133
{{ctx.Locale.Tr "settings.delete_account"}}
133134
</h4>
@@ -151,7 +152,18 @@
151152
</button>
152153
</div>
153154
</form>
155+
<div class="ui g-modal-confirm delete modal" id="delete-account">
156+
<div class="header">
157+
{{svg "octicon-trash"}}
158+
{{ctx.Locale.Tr "settings.delete_account_title"}}
159+
</div>
160+
<div class="content">
161+
<p>{{ctx.Locale.Tr "settings.delete_account_desc"}}</p>
162+
</div>
163+
{{template "base/modal_actions_confirm" .}}
164+
</div>
154165
</div>
166+
{{end}}
155167
</div>
156168

157169
<div class="ui g-modal-confirm delete modal" id="delete-email">
@@ -165,15 +177,4 @@
165177
{{template "base/modal_actions_confirm" .}}
166178
</div>
167179

168-
<div class="ui g-modal-confirm delete modal" id="delete-account">
169-
<div class="header">
170-
{{svg "octicon-trash"}}
171-
{{ctx.Locale.Tr "settings.delete_account_title"}}
172-
</div>
173-
<div class="content">
174-
<p>{{ctx.Locale.Tr "settings.delete_account_desc"}}</p>
175-
</div>
176-
{{template "base/modal_actions_confirm" .}}
177-
</div>
178-
179180
{{template "user/settings/layout_footer" .}}

0 commit comments

Comments
 (0)