diff options
author | kimsible <kimsible@users.noreply.github.com> | 2020-08-07 14:03:28 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-14 15:03:38 +0200 |
commit | f63c03fb6ecccb5ac8e0d88917f072339b38ffb5 (patch) | |
tree | 37d9dc9fd18057e5071cfc7bba51177d02d8c094 /client/src/app/+videos/+video-watch/comment/video-comment.component.ts | |
parent | 09f8f73fbc8177930c76171300d4abc9f380d746 (diff) | |
download | PeerTube-f63c03fb6ecccb5ac8e0d88917f072339b38ffb5.tar.gz PeerTube-f63c03fb6ecccb5ac8e0d88917f072339b38ffb5.tar.zst PeerTube-f63c03fb6ecccb5ac8e0d88917f072339b38ffb5.zip |
Add delete & re-draft for comments without replies
Diffstat (limited to 'client/src/app/+videos/+video-watch/comment/video-comment.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-watch/comment/video-comment.component.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts index a84e91fd3..507132909 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts | |||
@@ -22,9 +22,11 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
22 | @Input() inReplyToCommentId: number | 22 | @Input() inReplyToCommentId: number |
23 | @Input() highlightedComment = false | 23 | @Input() highlightedComment = false |
24 | @Input() firstInThread = false | 24 | @Input() firstInThread = false |
25 | @Input() redraftValue?: string | ||
25 | 26 | ||
26 | @Output() wantedToDelete = new EventEmitter<VideoComment>() | ||
27 | @Output() wantedToReply = new EventEmitter<VideoComment>() | 27 | @Output() wantedToReply = new EventEmitter<VideoComment>() |
28 | @Output() wantedToDelete = new EventEmitter<VideoComment>() | ||
29 | @Output() wantedToRedraft = new EventEmitter<VideoComment>() | ||
28 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() | 30 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() |
29 | @Output() resetReply = new EventEmitter() | 31 | @Output() resetReply = new EventEmitter() |
30 | @Output() timestampClicked = new EventEmitter<number>() | 32 | @Output() timestampClicked = new EventEmitter<number>() |
@@ -70,7 +72,10 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
70 | comment: createdComment, | 72 | comment: createdComment, |
71 | children: [] | 73 | children: [] |
72 | }) | 74 | }) |
75 | |||
73 | this.resetReply.emit() | 76 | this.resetReply.emit() |
77 | |||
78 | delete this.redraftValue | ||
74 | } | 79 | } |
75 | 80 | ||
76 | onWantToReply (comment?: VideoComment) { | 81 | onWantToReply (comment?: VideoComment) { |
@@ -81,6 +86,10 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
81 | this.wantedToDelete.emit(comment || this.comment) | 86 | this.wantedToDelete.emit(comment || this.comment) |
82 | } | 87 | } |
83 | 88 | ||
89 | onWantToRedraft (comment?: VideoComment) { | ||
90 | this.wantedToRedraft.emit(comment || this.comment) | ||
91 | } | ||
92 | |||
84 | isUserLoggedIn () { | 93 | isUserLoggedIn () { |
85 | return this.authService.isLoggedIn() | 94 | return this.authService.isLoggedIn() |
86 | } | 95 | } |
@@ -102,6 +111,10 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
102 | ) | 111 | ) |
103 | } | 112 | } |
104 | 113 | ||
114 | isRedraftableByUser () { | ||
115 | return this.comment.account && this.isUserLoggedIn() && this.user.account.id === this.comment.account.id && this.comment.totalReplies === 0 | ||
116 | } | ||
117 | |||
105 | switchToDefaultAvatar ($event: Event) { | 118 | switchToDefaultAvatar ($event: Event) { |
106 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 119 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() |
107 | } | 120 | } |