UserNotificationType
} from '@shared/models'
import {
+ ConfigCommand,
createMultipleServers,
doubleFollow,
PeerTubeServer,
await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
}
+// ---------------------------------------------------------------------------
+
async function checkUserRegistered (options: CheckerBaseParams & {
username: string
checkType: CheckerType
await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
}
+async function checkRegistrationRequest (options: CheckerBaseParams & {
+ username: string
+ registrationReason: string
+ checkType: CheckerType
+}) {
+ const { username, registrationReason } = options
+ const notificationType = UserNotificationType.NEW_USER_REGISTRATION_REQUEST
+
+ function notificationChecker (notification: UserNotification, checkType: CheckerType) {
+ if (checkType === 'presence') {
+ expect(notification).to.not.be.undefined
+ expect(notification.type).to.equal(notificationType)
+
+ expect(notification.registration.username).to.equal(username)
+ } else {
+ expect(notification).to.satisfy(n => n.type !== notificationType || n.registration.username !== username)
+ }
+ }
+
+ function emailNotificationFinder (email: object) {
+ const text: string = email['text']
+
+ return text.includes(' wants to register ') && text.includes(username) && text.includes(registrationReason)
+ }
+
+ await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
+}
+
+// ---------------------------------------------------------------------------
+
async function checkNewActorFollow (options: CheckerBaseParams & {
followType: 'channel' | 'account'
followerName: string
const port = await MockSmtpServer.Instance.collectEmails(emails)
const overrideConfig = {
- smtp: {
- hostname: '127.0.0.1',
- port
- },
+ ...ConfigCommand.getEmailOverrideConfig(port),
+
signup: {
limit: 20
}
userAccessToken,
emails,
servers,
- channelId
+ channelId,
+ baseOverrideConfig: overrideConfig
}
}
checkNewAccountAbuseForModerators,
checkNewPeerTubeVersion,
checkNewPluginVersion,
- checkVideoStudioEditionIsFinished
+ checkVideoStudioEditionIsFinished,
+ checkRegistrationRequest
}
// ---------------------------------------------------------------------------