Add ability to delete comments
[oweals/peertube.git] / client / src / app / videos / +video-watch / comment / video-comment.component.html
index 9608a10336a53a0b2a1418b55d459f181889b60d..4f9597607cd93e49b4a83ceda0b0aaab62ab3f33 100644 (file)
@@ -1,29 +1,39 @@
-<div class="comment">
-  <div class="comment-account-date">
-    <div class="comment-account">{{ comment.by }}</div>
-    <div class="comment-date">{{ comment.createdAt | myFromNow }}</div>
-  </div>
-  <div>{{ comment.text }}</div>
+<div class="root-comment">
+  <img [src]="getAvatarUrl(comment.account)" alt="Avatar" />
 
-  <div class="comment-actions">
-    <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div>
-  </div>
+  <div class="comment">
+    <div class="comment-account-date">
+      <a target="_blank" [href]="comment.account.url" class="comment-account">{{ comment.by }}</a>
+      <div class="comment-date">{{ comment.createdAt | myFromNow }}</div>
+    </div>
+    <div>{{ comment.text }}</div>
+
+    <div class="comment-actions">
+      <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div>
+      <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete">Delete</div>
+    </div>
 
-  <my-video-comment-add
-    *ngIf="isUserLoggedIn() && inReplyToCommentId === comment.id" [video]="video" [parentComment]="comment"
-    (commentCreated)="onCommentReplyCreated($event)"
-  ></my-video-comment-add>
+    <my-video-comment-add
+      *ngIf="isUserLoggedIn() && inReplyToCommentId === comment.id"
+      [user]="user"
+      [video]="video"
+      [parentComment]="comment"
+      [focusOnInit]="true"
+      (commentCreated)="onCommentReplyCreated($event)"
+    ></my-video-comment-add>
 
-  <div *ngIf="commentTree" class="children">
-    <div *ngFor="let commentChild of commentTree.children">
-      <my-video-comment
-        [comment]="commentChild.comment"
-        [video]="video"
-        [inReplyToCommentId]="inReplyToCommentId"
-        [commentTree]="commentChild"
-        (wantedToReply)="onWantedToReply($event)"
-        (resetReply)="onResetReply()"
-      ></my-video-comment>
+    <div *ngIf="commentTree" class="children">
+      <div *ngFor="let commentChild of commentTree.children">
+        <my-video-comment
+          [comment]="commentChild.comment"
+          [video]="video"
+          [inReplyToCommentId]="inReplyToCommentId"
+          [commentTree]="commentChild"
+          (wantedToReply)="onWantToReply($event)"
+          (wantedToDelete)="onWantToDelete($event)"
+          (resetReply)="onResetReply()"
+        ></my-video-comment>
+      </div>
     </div>
   </div>
 </div>