mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
Merge branch 'rebase-forgejo-moderation' into wip-forgejo
This commit is contained in:
commit
c6fe41239a
79 changed files with 2428 additions and 56 deletions
|
@ -1,5 +1,10 @@
|
|||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content organization profile">
|
||||
{{if .Flash}}
|
||||
<div class="ui container gt-mb-5">
|
||||
{{template "base/alert" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ui container gt-df">
|
||||
{{ctx.AvatarUtils.Avatar .Org 140 "org-avatar"}}
|
||||
<div id="org-info">
|
||||
|
|
21
templates/org/settings/blocked_users.tmpl
Normal file
21
templates/org/settings/blocked_users.tmpl
Normal file
|
@ -0,0 +1,21 @@
|
|||
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings blocked-users")}}
|
||||
<div class="org-setting-content">
|
||||
<div class="ui attached segment">
|
||||
<form class="ui form ignore-dirty gt-df gt-fw gt-gap-3" action="{{$.Link}}/block" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<input type="hidden" name="uid" value="">
|
||||
<div class="ui left">
|
||||
<div id="search-user-box" class="ui search">
|
||||
<div class="ui input">
|
||||
<input class="prompt" name="uname" placeholder="{{ctx.Locale.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="ui red button">{{ctx.Locale.Tr "user.block"}}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="ui attached segment">
|
||||
{{template "shared/blocked_users_list" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "org/settings/layout_footer" .}}
|
|
@ -38,6 +38,9 @@
|
|||
</div>
|
||||
</details>
|
||||
{{end}}
|
||||
<a class="{{if .PageIsSettingsBlockedUsers}}active {{end}}item" href="{{.OrgLink}}/settings/blocked_users">
|
||||
{{ctx.Locale.Tr "settings.blocked_users"}}
|
||||
</a>
|
||||
<a class="{{if .PageIsSettingsDelete}}active {{end}}item" href="{{.OrgLink}}/settings/delete">
|
||||
{{ctx.Locale.Tr "org.settings.delete"}}
|
||||
</a>
|
||||
|
|
28
templates/shared/blocked_users_list.tmpl
Normal file
28
templates/shared/blocked_users_list.tmpl
Normal file
|
@ -0,0 +1,28 @@
|
|||
<div class="flex-list">
|
||||
{{range .BlockedUsers}}
|
||||
<div class="flex-item flex-item-center">
|
||||
<div class="flex-item-leading">
|
||||
{{ctx.AvatarUtils.Avatar . 48}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<div class="flex-item-title">
|
||||
{{template "shared/user/name" .}}
|
||||
</div>
|
||||
<div class="flex-item-body">
|
||||
<span>{{ctx.Locale.Tr "settings.blocked_since" (DateTime "short" .CreatedUnix) | Safe}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-item-trailing">
|
||||
<form action="{{$.Link}}/unblock" method="post">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="user_id" value="{{.ID}}">
|
||||
<button class="ui red button">{{ctx.Locale.Tr "user.unblock"}}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="flex-item">
|
||||
<span class="text grey italic">{{ctx.Locale.Tr "settings.blocked_users_none"}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
|
@ -121,6 +121,18 @@
|
|||
</button>
|
||||
{{end}}
|
||||
</li>
|
||||
<li class="block">
|
||||
{{if $.IsBlocked}}
|
||||
<button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unblock&redirect_to={{$.Link}}">
|
||||
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unblock"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button type="submit" class="ui basic orange button delete-button"
|
||||
data-modal-id="block-user" data-url="{{.ContextUser.HomeLink}}?action=block">
|
||||
{{svg "octicon-blocked"}} {{ctx.Locale.Tr "user.block"}}
|
||||
</button>
|
||||
{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
243
templates/swagger/v1_json.tmpl
generated
243
templates/swagger/v1_json.tmpl
generated
|
@ -1852,6 +1852,45 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/block/{username}": {
|
||||
"put": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organization"
|
||||
],
|
||||
"summary": "Blocks a user from the organization",
|
||||
"operationId": "orgBlockUser",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the org",
|
||||
"name": "org",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "username of the user",
|
||||
"name": "username",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/hooks": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -2246,6 +2285,44 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/list_blocked": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organization"
|
||||
],
|
||||
"summary": "List the organization's blocked users",
|
||||
"operationId": "orgListBlockedUsers",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the org",
|
||||
"name": "org",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page number of results to return (1-based)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page size of results",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/BlockedUserList"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/members": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -2737,6 +2814,45 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/unblock/{username}": {
|
||||
"put": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organization"
|
||||
],
|
||||
"summary": "Unblock a user from the organization",
|
||||
"operationId": "orgUnblockUser",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the org",
|
||||
"name": "org",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "username of the user",
|
||||
"name": "username",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/packages/{owner}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -4237,6 +4353,9 @@
|
|||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"403": {
|
||||
"$ref": "#/responses/forbidden"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
|
@ -14913,6 +15032,38 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user/block/{username}": {
|
||||
"put": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Blocks a user from the doer.",
|
||||
"operationId": "userBlockUser",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "username of the user",
|
||||
"name": "username",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/emails": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -15090,6 +15241,9 @@
|
|||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"403": {
|
||||
"$ref": "#/responses/forbidden"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
|
@ -15565,6 +15719,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user/list_blocked": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "List the authenticated user's blocked users",
|
||||
"operationId": "userListBlockedUsers",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page number of results to return (1-based)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page size of results",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/BlockedUserList"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/orgs": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -15975,6 +16160,38 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user/unblock/{username}": {
|
||||
"put": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Unblocks a user from the doer.",
|
||||
"operationId": "userUnblockUser",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "username of the user",
|
||||
"name": "username",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/search": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -16938,6 +17155,23 @@
|
|||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"BlockedUser": {
|
||||
"type": "object",
|
||||
"title": "BlockedUser represents a blocked user.",
|
||||
"properties": {
|
||||
"block_id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "BlockID"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Created"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"Branch": {
|
||||
"description": "Branch represents a repository branch",
|
||||
"type": "object",
|
||||
|
@ -23293,6 +23527,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"BlockedUserList": {
|
||||
"description": "BlockedUserList",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/BlockedUser"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Branch": {
|
||||
"description": "Branch",
|
||||
"schema": {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content user profile">
|
||||
<div class="ui container">
|
||||
{{template "base/alert" .}}
|
||||
<div class="ui stackable grid">
|
||||
<div class="ui four wide column">
|
||||
{{template "shared/user/profile_big_avatar" .}}
|
||||
|
@ -39,4 +40,20 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui g-modal-confirm delete modal" id="block-user">
|
||||
<div class="header">
|
||||
{{ctx.Locale.Tr "user.block_user"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{ctx.Locale.Tr "user.block_user.detail"}}</p>
|
||||
<ul>
|
||||
<li>{{ctx.Locale.Tr "user.block_user.detail_1"}}</li>
|
||||
<li>{{ctx.Locale.Tr "user.block_user.detail_2"}}</li>
|
||||
<li>{{ctx.Locale.Tr "user.block_user.detail_3"}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
|
||||
{{template "base/footer" .}}
|
||||
|
|
10
templates/user/settings/blocked_users.tmpl
Normal file
10
templates/user/settings/blocked_users.tmpl
Normal file
|
@ -0,0 +1,10 @@
|
|||
{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings blocked-users")}}
|
||||
<div class="user-setting-content">
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "settings.blocked_users"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
{{template "shared/blocked_users_list" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "user/settings/layout_footer" .}}
|
|
@ -51,5 +51,8 @@
|
|||
<a class="{{if .PageIsSettingsRepos}}active {{end}}item" href="{{AppSubUrl}}/user/settings/repos">
|
||||
{{ctx.Locale.Tr "settings.repos"}}
|
||||
</a>
|
||||
<a class="{{if .PageIsBlockedUsers}}active {{end}}item" href="{{AppSubUrl}}/user/settings/blocked_users">
|
||||
{{ctx.Locale.Tr "settings.blocked_users"}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue