></div>
<div class="comment-actions">
- <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div>
- <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div>
- <div *ngIf="isRedraftableByUser()" (click)="onWantToRedraft()" class="comment-action-redraft" i18n>Delete & re-draft</div>
+ <div *ngIf="isUserLoggedIn()" tabindex=0 (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div>
<my-user-moderation-dropdown
- [prependActions]="prependModerationActions"
+ [prependActions]="prependModerationActions" tabindex=0
buttonSize="small" [account]="commentAccount" [user]="commentUser" i18n-label label="Options" placement="bottom-left auto"
></my-user-moderation-dropdown>
</div>
display: flex;
::ng-deep .dropdown-toggle,
- .comment-action-reply,
- .comment-action-delete,
- .comment-action-redraft {
+ .comment-action-reply {
color: pvar(--greyForegroundColor);
cursor: pointer;
margin-right: 10px;
- &:hover {
+ &:hover, &:active, &:focus, &:focus-visible {
color: pvar(--mainForegroundColor);
}
}
return this.comment.account && this.isUserLoggedIn() && this.user.account.id === this.comment.account.id && this.comment.totalReplies === 0
}
+ isReportableByUser() {
+ return this.comment.account && this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id
+ }
+
switchToDefaultAvatar ($event: Event) {
($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()
}
this.comment.account = null
}
- if (this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id) {
- this.prependModerationActions = [
- {
- label: $localize`Report comment`,
- handler: () => this.showReportModal()
- }
- ]
- } else {
+ this.prependModerationActions = []
+
+ if (this.isReportableByUser()) {
+ this.prependModerationActions.push({
+ label: $localize`Report comment`,
+ handler: () => this.showReportModal()
+ })
+ }
+
+ if (this.isRemovableByUser()) {
+ this.prependModerationActions.push({
+ label: $localize`Remove comment`,
+ handler: () => this.onWantToDelete()
+ })
+ }
+
+ if (this.isRedraftableByUser()) {
+ this.prependModerationActions.push({
+ label: $localize`Remove & re-draft comment`,
+ handler: () => this.onWantToRedraft()
+ })
+ }
+
+ if (this.prependModerationActions.length === 0) {
this.prependModerationActions = undefined
}
}