forked from forgejo/forgejo
[MODERATION] add user blocking API
- Follow up for: #540, #802 - Add API routes for user blocking from user and organization perspective. - The new routes have integration testing. - The new model functions have unit tests. - Actually quite boring to write and to read this pull request. (cherry picked from commitf3afaf15c7
) (cherry picked from commit6d754db3e5
) (cherry picked from commit2a89ddc0ac
) (cherry picked from commit4a147bff7e
) Conflicts: routers/api/v1/api.go templates/swagger/v1_json.tmpl
This commit is contained in:
parent
eff5b43d2e
commit
bb8c339185
12 changed files with 626 additions and 9 deletions
|
@ -900,6 +900,12 @@ func Routes() *web.Route {
|
|||
Delete(user.DeleteHook)
|
||||
}, reqWebhooksEnabled())
|
||||
|
||||
m.Group("", func() {
|
||||
m.Get("/list_blocked", user.ListBlockedUsers)
|
||||
m.Put("/block/{username}", user.BlockUser)
|
||||
m.Put("/unblock/{username}", user.UnblockUser)
|
||||
})
|
||||
|
||||
m.Group("/avatar", func() {
|
||||
m.Post("", bind(api.UpdateUserAvatarOption{}), user.UpdateAvatar)
|
||||
m.Delete("", user.DeleteAvatar)
|
||||
|
@ -1328,6 +1334,12 @@ func Routes() *web.Route {
|
|||
m.Delete("", org.DeleteAvatar)
|
||||
}, reqToken(), reqOrgOwnership())
|
||||
m.Get("/activities/feeds", org.ListOrgActivityFeeds)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Get("/list_blocked", reqToken(), reqOrgOwnership(), org.ListBlockedUsers)
|
||||
m.Put("/block/{username}", reqToken(), reqOrgOwnership(), org.BlockUser)
|
||||
m.Put("/unblock/{username}", reqToken(), reqOrgOwnership(), org.UnblockUser)
|
||||
}, reqToken(), reqOrgOwnership())
|
||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryOrganization), orgAssignment(true))
|
||||
m.Group("/teams/{teamid}", func() {
|
||||
m.Combo("").Get(reqToken(), org.GetTeam).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue