mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +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
|
@ -1,6 +1,6 @@
|
|||
import * as express from 'express'
|
||||
import { getFormattedObjects } from '../../helpers/utils'
|
||||
import { asyncMiddleware, paginationValidator, setDefaultSort, setPagination } from '../../middlewares'
|
||||
import { asyncMiddleware, paginationValidator, setDefaultSort, setDefaultPagination } from '../../middlewares'
|
||||
import { accountsGetValidator, accountsSortValidator } from '../../middlewares/validators'
|
||||
import { AccountModel } from '../../models/account/account'
|
||||
|
||||
|
@ -10,7 +10,7 @@ accountsRouter.get('/',
|
|||
paginationValidator,
|
||||
accountsSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listAccounts)
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import * as express from 'express'
|
||||
import { UserRight } from '../../../shared/models/users'
|
||||
import { getFormattedObjects } from '../../helpers/utils'
|
||||
import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setDefaultSort, setPagination } from '../../middlewares'
|
||||
import {
|
||||
asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setDefaultPagination,
|
||||
setDefaultSort
|
||||
} from '../../middlewares'
|
||||
import { paginationValidator } from '../../middlewares/validators'
|
||||
import { JobModel } from '../../models/job/job'
|
||||
|
||||
|
@ -13,7 +16,7 @@ jobsRouter.get('/',
|
|||
paginationValidator,
|
||||
jobsSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listJobs)
|
||||
)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { getOrCreateActorAndServerAndModel } from '../../../lib/activitypub/acto
|
|||
import { sendFollow, sendUndoFollow } from '../../../lib/activitypub/send'
|
||||
import {
|
||||
asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, removeFollowingValidator, setBodyHostsPort, setDefaultSort,
|
||||
setPagination
|
||||
setDefaultPagination
|
||||
} from '../../../middlewares'
|
||||
import { followersSortValidator, followingSortValidator, followValidator } from '../../../middlewares/validators'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
|
@ -22,7 +22,7 @@ serverFollowsRouter.get('/following',
|
|||
paginationValidator,
|
||||
followingSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listFollowing)
|
||||
)
|
||||
|
||||
|
@ -45,7 +45,7 @@ serverFollowsRouter.get('/followers',
|
|||
paginationValidator,
|
||||
followersSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listFollowers)
|
||||
)
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { getFormattedObjects } from '../../../helpers/utils'
|
|||
import { sequelizeTypescript } from '../../../initializers'
|
||||
import { sendVideoAbuse } from '../../../lib/activitypub/send'
|
||||
import {
|
||||
asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, setDefaultSort, setPagination, videoAbuseReportValidator,
|
||||
asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, setDefaultSort, setDefaultPagination, videoAbuseReportValidator,
|
||||
videoAbusesSortValidator
|
||||
} from '../../../middlewares'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
|
@ -21,7 +21,7 @@ abuseVideoRouter.get('/abuse',
|
|||
paginationValidator,
|
||||
videoAbusesSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listVideoAbuses)
|
||||
)
|
||||
abuseVideoRouter.post('/:id/abuse',
|
||||
|
|
|
@ -3,7 +3,7 @@ import { BlacklistedVideo, UserRight } from '../../../../shared'
|
|||
import { logger } from '../../../helpers/logger'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import {
|
||||
asyncMiddleware, authenticate, blacklistSortValidator, ensureUserHasRight, paginationValidator, setBlacklistSort, setPagination,
|
||||
asyncMiddleware, authenticate, blacklistSortValidator, ensureUserHasRight, paginationValidator, setBlacklistSort, setDefaultPagination,
|
||||
videosBlacklistAddValidator, videosBlacklistRemoveValidator
|
||||
} from '../../../middlewares'
|
||||
import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
|
||||
|
@ -23,7 +23,7 @@ blacklistRouter.get('/blacklist',
|
|||
paginationValidator,
|
||||
blacklistSortValidator,
|
||||
setBlacklistSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listBlacklist)
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import { sequelizeTypescript } from '../../../initializers'
|
|||
import { setAsyncActorKeys } from '../../../lib/activitypub'
|
||||
import { createVideoChannel } from '../../../lib/video-channel'
|
||||
import {
|
||||
asyncMiddleware, authenticate, listVideoAccountChannelsValidator, paginationValidator, setDefaultSort, setPagination,
|
||||
asyncMiddleware, authenticate, listVideoAccountChannelsValidator, paginationValidator, setDefaultSort, setDefaultPagination,
|
||||
videoChannelsAddValidator, videoChannelsGetValidator, videoChannelsRemoveValidator, videoChannelsSortValidator,
|
||||
videoChannelsUpdateValidator
|
||||
} from '../../../middlewares'
|
||||
|
@ -20,7 +20,7 @@ videoChannelRouter.get('/channels',
|
|||
paginationValidator,
|
||||
videoChannelsSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listVideoChannels)
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { logger } from '../../../helpers/logger'
|
|||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { sequelizeTypescript } from '../../../initializers'
|
||||
import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment'
|
||||
import { asyncMiddleware, authenticate, paginationValidator, setDefaultSort, setPagination } from '../../../middlewares'
|
||||
import { asyncMiddleware, authenticate, paginationValidator, setDefaultSort, setDefaultPagination } from '../../../middlewares'
|
||||
import { videoCommentThreadsSortValidator } from '../../../middlewares/validators'
|
||||
import {
|
||||
addVideoCommentReplyValidator, addVideoCommentThreadValidator, listVideoCommentThreadsValidator, listVideoThreadCommentsValidator,
|
||||
|
@ -21,7 +21,7 @@ videoCommentRouter.get('/:videoId/comment-threads',
|
|||
paginationValidator,
|
||||
videoCommentThreadsSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listVideoCommentThreadsValidator),
|
||||
asyncMiddleware(listVideoThreads)
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@ import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServer
|
|||
import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send'
|
||||
import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler'
|
||||
import {
|
||||
asyncMiddleware, authenticate, paginationValidator, setDefaultSort, setPagination, videosAddValidator, videosGetValidator,
|
||||
asyncMiddleware, authenticate, paginationValidator, setDefaultSort, setDefaultPagination, videosAddValidator, videosGetValidator,
|
||||
videosRemoveValidator, videosSearchValidator, videosSortValidator, videosUpdateValidator
|
||||
} from '../../../middlewares'
|
||||
import { TagModel } from '../../../models/video/tag'
|
||||
|
@ -45,7 +45,7 @@ videosRouter.get('/',
|
|||
paginationValidator,
|
||||
videosSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(listVideos)
|
||||
)
|
||||
videosRouter.get('/search',
|
||||
|
@ -53,7 +53,7 @@ videosRouter.get('/search',
|
|||
paginationValidator,
|
||||
videosSortValidator,
|
||||
setDefaultSort,
|
||||
setPagination,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(searchVideos)
|
||||
)
|
||||
videosRouter.put('/:id',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue