mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-20 00:51:07 +02:00
feat: invites regardless of registration type, invite privilege, groups to join on acceptance (#8786)
* feat: allow invites in normal registration mode + invite privilege * feat: select groups to join from an invite * test: check if groups from invitations have been joined * fix: remove unused variable * feat: write API versions of socket calls * docs: openapi specs for the new routes * test: iron out mongo redis difference * refactor: move inviteGroups endpoint into write API * refactor: use GET /api/v3/users/:uid/invites/groups Instead of GET /api/v3/users/:uid/inviteGroups * fix: no need for /api/v3 prefix when using api module * fix: tests * refactor: change POST /api/v3/users/invite To POST /api/v3/users/:uid/invites * refactor: make helpers.invite awaitable * fix: restrict invite API to self-use only * fix: move invite groups controller to write api, +tests * fix: tests Co-authored-by: Julian Lam <julian@nodebb.org>
This commit is contained in:
48
public/openapi/write/users/uid/invites.yaml
Normal file
48
public/openapi/write/users/uid/invites.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
post:
|
||||
tags:
|
||||
- users
|
||||
summary: invite users with email by email
|
||||
description: This operation sends an invitation email to the given addresses, with an option to join selected groups on acceptance
|
||||
parameters:
|
||||
- in: path
|
||||
name: uid
|
||||
schema:
|
||||
type: integer
|
||||
required: true
|
||||
description: uid of the user sending invitations
|
||||
example: 1
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
emails:
|
||||
type: string
|
||||
description: A single or list of comma separated email addresses
|
||||
example: friend01@example.com,friend02@example.com
|
||||
groupsToJoin:
|
||||
type: array
|
||||
description: A collection of group names
|
||||
example: ['administrators']
|
||||
required:
|
||||
- emails
|
||||
responses:
|
||||
'200':
|
||||
description: invitation email(s) sent
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
$ref: ../../../components/schemas/Status.yaml#/Status
|
||||
response:
|
||||
type: object
|
||||
'400':
|
||||
$ref: ../../../components/responses/400.yaml#/400
|
||||
'401':
|
||||
$ref: ../../../components/responses/401.yaml#/401
|
||||
'403':
|
||||
$ref: ../../../components/responses/403.yaml#/403
|
||||
23
public/openapi/write/users/uid/invites/groups.yaml
Normal file
23
public/openapi/write/users/uid/invites/groups.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
get:
|
||||
tags:
|
||||
- users
|
||||
summary: Get group names that the user can invite
|
||||
parameters:
|
||||
- in: path
|
||||
name: uid
|
||||
schema:
|
||||
type: integer
|
||||
required: true
|
||||
description: uid of the user to make the query for
|
||||
example: 1
|
||||
responses:
|
||||
'200':
|
||||
description: A collection of group names returned
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
'401':
|
||||
$ref: ../../../../components/responses/401.yaml#/401
|
||||
Reference in New Issue
Block a user