aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-20 10:12:31 +0100
committerChocobozzz <me@florianbigard.com>2019-03-20 10:12:31 +0100
commit7e73f07131a6738b299311448ab4491eb532838a (patch)
tree38705b4e65a1e3ee0e5ecf7417ad827ed32c9381 /client
parent308421283adf8df1a6a1972cd0efe198b0d93435 (diff)
downloadPeerTube-7e73f07131a6738b299311448ab4491eb532838a.tar.gz
PeerTube-7e73f07131a6738b299311448ab4491eb532838a.tar.zst
PeerTube-7e73f07131a6738b299311448ab4491eb532838a.zip
Improve comment deletion message
Diffstat (limited to 'client')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.model.ts7
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts7
2 files changed, 14 insertions, 0 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
index 824fb24c3..3ed3ddcc7 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
@@ -1,6 +1,7 @@
1import { Account as AccountInterface } from '../../../../../../shared/models/actors' 1import { Account as AccountInterface } from '../../../../../../shared/models/actors'
2import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model' 2import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model'
3import { Actor } from '@app/shared/actor/actor.model' 3import { Actor } from '@app/shared/actor/actor.model'
4import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
4 5
5export class VideoComment implements VideoCommentServerModel { 6export class VideoComment implements VideoCommentServerModel {
6 id: number 7 id: number
@@ -16,6 +17,8 @@ export class VideoComment implements VideoCommentServerModel {
16 by: string 17 by: string
17 accountAvatarUrl: string 18 accountAvatarUrl: string
18 19
20 isLocal: boolean
21
19 constructor (hash: VideoCommentServerModel) { 22 constructor (hash: VideoCommentServerModel) {
20 this.id = hash.id 23 this.id = hash.id
21 this.url = hash.url 24 this.url = hash.url
@@ -30,5 +33,9 @@ export class VideoComment implements VideoCommentServerModel {
30 33
31 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) 34 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
32 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) 35 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
36
37 const absoluteAPIUrl = getAbsoluteAPIUrl()
38 const thisHost = new URL(absoluteAPIUrl).host
39 this.isLocal = this.account.host.trim() === thisHost
33 } 40 }
34} 41}
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index 2616820d2..3acddbe6a 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -121,10 +121,17 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
121 121
122 async onWantedToDelete (commentToDelete: VideoComment) { 122 async onWantedToDelete (commentToDelete: VideoComment) {
123 let message = 'Do you really want to delete this comment?' 123 let message = 'Do you really want to delete this comment?'
124
124 if (commentToDelete.totalReplies !== 0) { 125 if (commentToDelete.totalReplies !== 0) {
125 message += this.i18n(' {{totalReplies}} replies will be deleted too.', { totalReplies: commentToDelete.totalReplies }) 126 message += this.i18n(' {{totalReplies}} replies will be deleted too.', { totalReplies: commentToDelete.totalReplies })
126 } 127 }
127 128
129 if (commentToDelete.isLocal) {
130 message += this.i18n(' The deletion will be sent to remote instances so they remove the comment too.')
131 } else {
132 message += this.i18n(' It is a remote comment, so the deletion will only be effective on your instance.')
133 }
134
128 const res = await this.confirmService.confirm(message, this.i18n('Delete')) 135 const res = await this.confirmService.confirm(message, this.i18n('Delete'))
129 if (res === false) return 136 if (res === false) return
130 137