aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-26 10:36:24 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-01-09 11:15:15 +0100
commitcef534ed53e4518fe0acf581bfe880788d42fc36 (patch)
tree115b51ea5136849a2336d44915c7780649f25dc2 /server/models/video
parent1de1d05f4c61fe059fa5e24e79c92582f0e7e4b3 (diff)
downloadPeerTube-cef534ed53e4518fe0acf581bfe880788d42fc36.tar.gz
PeerTube-cef534ed53e4518fe0acf581bfe880788d42fc36.tar.zst
PeerTube-cef534ed53e4518fe0acf581bfe880788d42fc36.zip
Add user notification base code
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-abuse.ts5
-rw-r--r--server/models/video/video-blacklist.ts10
-rw-r--r--server/models/video/video-comment.ts4
-rw-r--r--server/models/video/video.ts4
4 files changed, 8 insertions, 15 deletions
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index dbb88ca45..4c9e2d05e 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -86,11 +86,6 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {
86 }) 86 })
87 Video: VideoModel 87 Video: VideoModel
88 88
89 @AfterCreate
90 static sendEmailNotification (instance: VideoAbuseModel) {
91 return Emailer.Instance.addVideoAbuseReportJob(instance.videoId)
92 }
93
94 static loadByIdAndVideoId (id: number, videoId: number) { 89 static loadByIdAndVideoId (id: number, videoId: number) {
95 const query = { 90 const query = {
96 where: { 91 where: {
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts
index 67f7cd487..23e992685 100644
--- a/server/models/video/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -53,16 +53,6 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
53 }) 53 })
54 Video: VideoModel 54 Video: VideoModel
55 55
56 @AfterCreate
57 static sendBlacklistEmailNotification (instance: VideoBlacklistModel) {
58 return Emailer.Instance.addVideoBlacklistReportJob(instance.videoId, instance.reason)
59 }
60
61 @AfterDestroy
62 static sendUnblacklistEmailNotification (instance: VideoBlacklistModel) {
63 return Emailer.Instance.addVideoUnblacklistReportJob(instance.videoId)
64 }
65
66 static listForApi (start: number, count: number, sort: SortType) { 56 static listForApi (start: number, count: number, sort: SortType) {
67 const query = { 57 const query = {
68 offset: start, 58 offset: start,
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index dd6d08139..d8fc2a564 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -448,6 +448,10 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
448 } 448 }
449 } 449 }
450 450
451 getCommentStaticPath () {
452 return this.Video.getWatchStaticPath() + ';threadId=' + this.getThreadId()
453 }
454
451 getThreadId (): number { 455 getThreadId (): number {
452 return this.originCommentId || this.id 456 return this.originCommentId || this.id
453 } 457 }
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index bcf327f32..fc200e5d1 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1527,6 +1527,10 @@ export class VideoModel extends Model<VideoModel> {
1527 videoFile.infoHash = parsedTorrent.infoHash 1527 videoFile.infoHash = parsedTorrent.infoHash
1528 } 1528 }
1529 1529
1530 getWatchStaticPath () {
1531 return '/videos/watch/' + this.uuid
1532 }
1533
1530 getEmbedStaticPath () { 1534 getEmbedStaticPath () {
1531 return '/videos/embed/' + this.uuid 1535 return '/videos/embed/' + this.uuid
1532 } 1536 }