UserNotificationSettingValue,
UserNotificationType
} from '@shared/models'
-import { createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
+import {
+ createMultipleServers,
+ doubleFollow,
+ PeerTubeServer,
+ setAccessTokensToServers,
+ setDefaultAccountAvatar,
+ setDefaultChannelAvatar
+} from '@shared/server-commands'
import { MockSmtpServer } from './mock-servers'
type CheckerBaseParams = {
abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
+ myVideoEditionFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
}
}
await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
}
+async function checkVideoEditionIsFinished (options: CheckerBaseParams & {
+ videoName: string
+ shortUUID: string
+ checkType: CheckerType
+}) {
+ const { videoName, shortUUID } = options
+ const notificationType = UserNotificationType.MY_VIDEO_EDITION_FINISHED
+
+ function notificationChecker (notification: UserNotification, checkType: CheckerType) {
+ if (checkType === 'presence') {
+ expect(notification).to.not.be.undefined
+ expect(notification.type).to.equal(notificationType)
+
+ checkVideo(notification.video, videoName, shortUUID)
+ checkActor(notification.video.channel)
+ } else {
+ expect(notification.video).to.satisfy(v => v === undefined || v.name !== videoName)
+ }
+ }
+
+ function emailNotificationFinder (email: object) {
+ const text: string = email['text']
+ return text.includes(shortUUID) && text.includes('Edition of your video')
+ }
+
+ await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
+}
+
async function checkMyVideoImportIsFinished (options: CheckerBaseParams & {
videoName: string
shortUUID: string
const servers = await createMultipleServers(serversCount, Object.assign(overrideConfig, overrideConfigArg))
await setAccessTokensToServers(servers)
+ await setDefaultChannelAvatar(servers)
+ await setDefaultAccountAvatar(servers)
+
+ await servers[1].config.enableEditor()
if (serversCount > 1) {
await doubleFollow(servers[0], servers[1])
checkNewCommentAbuseForModerators,
checkNewAccountAbuseForModerators,
checkNewPeerTubeVersion,
- checkNewPluginVersion
+ checkNewPluginVersion,
+ checkVideoEditionIsFinished
}
// ---------------------------------------------------------------------------