fix deleted comment layout and its notification display

pull/2356/head
Rigel Kent 2019-12-19 18:08:21 +01:00
parent 10475dea7d
commit c5c09c1e50
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
7 changed files with 70 additions and 14 deletions

View File

@ -65,6 +65,13 @@ export class AvatarNotificationComponent implements OnInit, OnDestroy {
markAllAsRead () { markAllAsRead () {
this.userNotificationService.markAllAsRead() this.userNotificationService.markAllAsRead()
.subscribe(
() => {
this.unreadNotifications = 0
},
err => this.notifier.error(err.message)
)
} }
private async subscribeToNotifications () { private async subscribeToNotifications () {

View File

@ -102,6 +102,7 @@ export class UserNotification implements UserNotificationServer {
case UserNotificationType.NEW_COMMENT_ON_MY_VIDEO: case UserNotificationType.NEW_COMMENT_ON_MY_VIDEO:
case UserNotificationType.COMMENT_MENTION: case UserNotificationType.COMMENT_MENTION:
if (!this.comment) break
this.accountUrl = this.buildAccountUrl(this.comment.account) this.accountUrl = this.buildAccountUrl(this.comment.account)
this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ] this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ]
break break

View File

@ -5,11 +5,25 @@
<ng-container [ngSwitch]="notification.type"> <ng-container [ngSwitch]="notification.type">
<ng-container *ngSwitchCase="UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION"> <ng-container *ngSwitchCase="UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION">
<img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.video.channel.avatarUrl" /> <ng-container *ngIf="notification.video; then hasVideo; else noVideo"></ng-container>
<div class="message" i18n> <ng-template #hasVideo>
{{ notification.video.channel.displayName }} published a new video: <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.video.name }}</a> <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
</div> <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.video.channel.avatarUrl" />
</a>
<div class="message" i18n>
{{ notification.video.channel.displayName }} published a new video: <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.video.name }}</a>
</div>
</ng-template>
<ng-template #noVideo>
<my-global-icon iconName="alert"></my-global-icon>
<div class="message" i18n>
The notification concerns a video now unavailable
</div>
</ng-template>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="UserNotificationType.UNBLACKLIST_ON_MY_VIDEO"> <ng-container *ngSwitchCase="UserNotificationType.UNBLACKLIST_ON_MY_VIDEO">
@ -45,11 +59,25 @@
</ng-container> </ng-container>
<ng-container *ngSwitchCase="UserNotificationType.NEW_COMMENT_ON_MY_VIDEO"> <ng-container *ngSwitchCase="UserNotificationType.NEW_COMMENT_ON_MY_VIDEO">
<img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" /> <ng-container *ngIf="notification.comment; then hasComment; else noComment"></ng-container>
<div class="message" i18n> <ng-template #hasComment>
<a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> commented your video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.comment.video.name }}</a> <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
</div> <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" />
</a>
<div class="message" i18n>
<a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> commented your video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.comment.video.name }}</a>
</div>
</ng-template>
<ng-template #noComment>
<my-global-icon iconName="alert"></my-global-icon>
<div class="message" i18n>
The notification concerns a comment now unavailable
</div>
</ng-template>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="UserNotificationType.MY_VIDEO_PUBLISHED"> <ng-container *ngSwitchCase="UserNotificationType.MY_VIDEO_PUBLISHED">
@ -80,12 +108,14 @@
<my-global-icon iconName="user-add"></my-global-icon> <my-global-icon iconName="user-add"></my-global-icon>
<div class="message" i18n> <div class="message" i18n>
User <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.account.name }} registered</a> on your instance User <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.account.name }}</a> registered on your instance
</div> </div>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="UserNotificationType.NEW_FOLLOW"> <ng-container *ngSwitchCase="UserNotificationType.NEW_FOLLOW">
<img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.actorFollow.follower.avatarUrl" /> <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
<img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.actorFollow.follower.avatarUrl" />
</a>
<div class="message" i18n> <div class="message" i18n>
<a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.actorFollow.follower.displayName }}</a> is following <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.actorFollow.follower.displayName }}</a> is following
@ -96,7 +126,9 @@
</ng-container> </ng-container>
<ng-container *ngSwitchCase="UserNotificationType.COMMENT_MENTION"> <ng-container *ngSwitchCase="UserNotificationType.COMMENT_MENTION">
<img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" /> <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
<img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" />
</a>
<div class="message" i18n> <div class="message" i18n>
<a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> mentioned you on <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">video {{ notification.comment.video.name }}</a> <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> mentioned you on <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">video {{ notification.comment.video.name }}</a>
@ -119,8 +151,16 @@
Your instance automatically followed <a (click)="markAsRead(notification)" [routerLink]="notification.instanceFollowUrl">{{ notification.actorFollow.following.host }}</a> Your instance automatically followed <a (click)="markAsRead(notification)" [routerLink]="notification.instanceFollowUrl">{{ notification.actorFollow.following.host }}</a>
</div> </div>
</ng-container> </ng-container>
<ng-container *ngSwitchDefault>
<my-global-icon iconName="alert"></my-global-icon>
<div class="message" i18n>
The notification points to a content now unavailable
</div>
</ng-container>
</ng-container> </ng-container>
<div class="from-date">{{ notification.createdAt | myFromNow }}</div> <div [title]="notification.createdAt" class="from-date">{{ notification.createdAt | myFromNow }}</div>
</div> </div>
</div> </div>

View File

@ -48,5 +48,6 @@
padding-left: 5px; padding-left: 5px;
min-width: 70px; min-width: 70px;
text-align: right; text-align: right;
margin-left: auto;
} }
} }

View File

@ -1,4 +1,8 @@
<div class="video-feed"> <div class="video-feed"
[ngbTooltip]="'Feeds available'"
placement="right auto"
container="body"
>
<my-global-icon <my-global-icon
*ngIf="syndicationItems.length !== 0" [ngbPopover]="feedsList" [autoClose]="true" placement="bottom" *ngIf="syndicationItems.length !== 0" [ngbPopover]="feedsList" [autoClose]="true" placement="bottom"
class="icon-syndication" role="button" iconName="syndication" class="icon-syndication" role="button" iconName="syndication"

View File

@ -2,6 +2,8 @@
@import '_mixins'; @import '_mixins';
.video-feed { .video-feed {
width: min-content;
a { a {
color: black; color: black;
display: block; display: block;

View File

@ -15,7 +15,7 @@
width: 2px; width: 2px;
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.05); background-color: rgba(0, 0, 0, 0.05);
margin: 10px 0; margin: 10px calc(1rem + 1px);
} }
} }
@ -106,6 +106,7 @@
&.comment-html-deleted { &.comment-html-deleted {
color: $grey-foreground-color; color: $grey-foreground-color;
margin-bottom: 1rem;
} }
} }