1
0
Fork 0
peertube/server/helpers/custom-validators/activitypub/rate.ts
2017-11-27 19:40:53 +01:00

20 lines
600 B
TypeScript

import { isActivityPubUrlValid, isBaseActivityValid } from './misc'
function isLikeActivityValid (activity: any) {
return isBaseActivityValid(activity, 'Like') &&
isActivityPubUrlValid(activity.object)
}
function isDislikeActivityValid (activity: any) {
return isBaseActivityValid(activity, 'Create') &&
activity.object.type === 'Dislike' &&
isActivityPubUrlValid(activity.object.actor) &&
isActivityPubUrlValid(activity.object.object)
}
// ---------------------------------------------------------------------------
export {
isLikeActivityValid,
isDislikeActivityValid
}