1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add new plugin/peertube version notifs

This commit is contained in:
Chocobozzz 2021-03-11 16:54:52 +01:00
parent 3fbc697433
commit 32a18cbf33
No known key found for this signature in database
GPG key ID: 583A612D890159BE
44 changed files with 808 additions and 37 deletions

View file

@ -12,7 +12,7 @@ import { isTestInstance, root } from '../helpers/core-utils'
import { bunyanLogger, logger } from '../helpers/logger'
import { CONFIG, isEmailEnabled } from '../initializers/config'
import { WEBSERVER } from '../initializers/constants'
import { MAbuseFull, MAbuseMessage, MAccountDefault, MActorFollowActors, MActorFollowFull, MUser } from '../types/models'
import { MAbuseFull, MAbuseMessage, MAccountDefault, MActorFollowActors, MActorFollowFull, MPlugin, MUser } from '../types/models'
import { MCommentOwnerVideo, MVideo, MVideoAccountLight } from '../types/models/video'
import { JobQueue } from './job-queue'
@ -403,7 +403,7 @@ class Emailer {
}
async addVideoAutoBlacklistModeratorsNotification (to: string[], videoBlacklist: MVideoBlacklistLightVideo) {
const VIDEO_AUTO_BLACKLIST_URL = WEBSERVER.URL + '/admin/moderation/video-auto-blacklist/list'
const videoAutoBlacklistUrl = WEBSERVER.URL + '/admin/moderation/video-auto-blacklist/list'
const videoUrl = WEBSERVER.URL + videoBlacklist.Video.getWatchStaticPath()
const channel = (await VideoChannelModel.loadByIdAndPopulateAccount(videoBlacklist.Video.channelId)).toFormattedSummaryJSON()
@ -417,7 +417,7 @@ class Emailer {
videoName: videoBlacklist.Video.name,
action: {
text: 'Review autoblacklist',
url: VIDEO_AUTO_BLACKLIST_URL
url: videoAutoBlacklistUrl
}
}
}
@ -472,6 +472,42 @@ class Emailer {
return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
}
addNewPeerTubeVersionNotification (to: string[], latestVersion: string) {
const subject = `A new PeerTube version is available: ${latestVersion}`
const emailPayload: EmailPayload = {
to,
template: 'peertube-version-new',
subject,
text: subject,
locals: {
latestVersion
}
}
return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
}
addNewPlugionVersionNotification (to: string[], plugin: MPlugin) {
const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + plugin.type
const subject = `A new plugin/theme version is available: ${plugin.name}@${plugin.latestVersion}`
const emailPayload: EmailPayload = {
to,
template: 'plugin-version-new',
subject,
text: subject,
locals: {
pluginName: plugin.name,
latestVersion: plugin.latestVersion,
pluginUrl
}
}
return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
}
addPasswordResetEmailJob (username: string, to: string, resetPasswordUrl: string) {
const emailPayload: EmailPayload = {
template: 'password-reset',