c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
97 lines
2.3 KiB
Go
97 lines
2.3 KiB
Go
// Copyright 2024 The Gitea Authors.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package user
|
|
|
|
import (
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/routers/api/v1/shared"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/context"
|
|
)
|
|
|
|
func ListBlocks(ctx *context.APIContext) {
|
|
// swagger:operation GET /user/blocks user userListBlocks
|
|
// ---
|
|
// summary: List users blocked by the authenticated user
|
|
// parameters:
|
|
// - name: page
|
|
// in: query
|
|
// description: page number of results to return (1-based)
|
|
// type: integer
|
|
// - name: limit
|
|
// in: query
|
|
// description: page size of results
|
|
// type: integer
|
|
// produces:
|
|
// - application/json
|
|
// responses:
|
|
// "200":
|
|
// "$ref": "#/responses/UserList"
|
|
|
|
shared.ListBlocks(ctx, ctx.Doer)
|
|
}
|
|
|
|
func CheckUserBlock(ctx *context.APIContext) {
|
|
// swagger:operation GET /user/blocks/{username} user userCheckUserBlock
|
|
// ---
|
|
// summary: Check if a user is blocked by the authenticated user
|
|
// parameters:
|
|
// - name: username
|
|
// in: path
|
|
// description: username of the user to check
|
|
// type: string
|
|
// required: true
|
|
// responses:
|
|
// "204":
|
|
// "$ref": "#/responses/empty"
|
|
// "404":
|
|
// "$ref": "#/responses/notFound"
|
|
|
|
shared.CheckUserBlock(ctx, ctx.Doer)
|
|
}
|
|
|
|
func BlockUser(ctx *context.APIContext) {
|
|
// swagger:operation PUT /user/blocks/{username} user userBlockUser
|
|
// ---
|
|
// summary: Block a user
|
|
// parameters:
|
|
// - name: username
|
|
// in: path
|
|
// description: username of the user to block
|
|
// type: string
|
|
// required: true
|
|
// - name: note
|
|
// in: query
|
|
// description: optional note for the block
|
|
// type: string
|
|
// responses:
|
|
// "204":
|
|
// "$ref": "#/responses/empty"
|
|
// "404":
|
|
// "$ref": "#/responses/notFound"
|
|
// "422":
|
|
// "$ref": "#/responses/validationError"
|
|
|
|
shared.BlockUser(ctx, ctx.Doer)
|
|
}
|
|
|
|
func UnblockUser(ctx *context.APIContext) {
|
|
// swagger:operation DELETE /user/blocks/{username} user userUnblockUser
|
|
// ---
|
|
// summary: Unblock a user
|
|
// parameters:
|
|
// - name: username
|
|
// in: path
|
|
// description: username of the user to unblock
|
|
// type: string
|
|
// required: true
|
|
// responses:
|
|
// "204":
|
|
// "$ref": "#/responses/empty"
|
|
// "404":
|
|
// "$ref": "#/responses/notFound"
|
|
// "422":
|
|
// "$ref": "#/responses/validationError"
|
|
|
|
shared.UnblockUser(ctx, ctx.Doer, ctx.Doer)
|
|
}
|