mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Don't show videos of remote instance after unfollow
This commit is contained in:
parent
1174a8479a
commit
f05a1c30c1
38 changed files with 402 additions and 211 deletions
|
@ -13,7 +13,7 @@ import { sendUpdateUser } from '../../lib/activitypub/send'
|
|||
import { createUserAccountAndChannel } from '../../lib/user'
|
||||
import {
|
||||
asyncMiddleware, authenticate, ensureUserHasRight, ensureUserRegistrationAllowed, paginationValidator, setDefaultSort,
|
||||
setPagination, token, usersAddValidator, usersGetValidator, usersRegisterValidator, usersRemoveValidator, usersSortValidator,
|
||||
setDefaultPagination, token, usersAddValidator, usersGetValidator, usersRegisterValidator, usersRemoveValidator, usersSortValidator,
|
||||
usersUpdateMeValidator, usersUpdateValidator, usersVideoRatingValidator
|
||||
} from '../../middlewares'
|
||||
import { usersUpdateMyAvatarValidator, videosSortValidator } from '../../middlewares/validators'
|
||||
|
@ -40,7 +40,7 @@ usersRouter.get('/me/videos',
|
|||
paginationValidator,
|
||||
videosSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(getUserVideos)
|
||||
)
|
||||
|
||||
|
@ -56,7 +56,7 @@ usersRouter.get('/',
|
|||
paginationValidator,
|
||||
usersSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listUsers)
|
||||
)
|
||||
|
||||
|
@ -129,15 +129,19 @@ async function createUserRetryWrapper (req: express.Request, res: express.Respon
|
|||
errorMessage: 'Cannot insert the user with many retries.'
|
||||
}
|
||||
|
||||
await retryTransactionWrapper(createUser, options)
|
||||
const { user, account } = await retryTransactionWrapper(createUser, options)
|
||||
|
||||
// TODO : include Location of the new user -> 201
|
||||
return res.type('json').status(204).end()
|
||||
return res.json({
|
||||
user: {
|
||||
id: user.id,
|
||||
uuid: account.uuid
|
||||
}
|
||||
}).end()
|
||||
}
|
||||
|
||||
async function createUser (req: express.Request) {
|
||||
const body: UserCreate = req.body
|
||||
const user = new UserModel({
|
||||
const userToCreate = new UserModel({
|
||||
username: body.username,
|
||||
password: body.password,
|
||||
email: body.email,
|
||||
|
@ -147,9 +151,11 @@ async function createUser (req: express.Request) {
|
|||
videoQuota: body.videoQuota
|
||||
})
|
||||
|
||||
await createUserAccountAndChannel(user)
|
||||
const { user, account } = await createUserAccountAndChannel(userToCreate)
|
||||
|
||||
logger.info('User %s with its channel and account created.', body.username)
|
||||
|
||||
return { user, account }
|
||||
}
|
||||
|
||||
async function registerUserRetryWrapper (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue