aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/users/user-notifications.component.html
blob: 9af6da784bcd6e161eee36e2125d2861c44438e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<div *ngIf="componentPagination.totalItems === 0" class="no-notification" i18n>You don't have notifications.</div>

<div class="notifications" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()">
  <div *ngFor="let notification of notifications" class="notification" [ngClass]="{ unread: !notification.read }" (click)="markAsRead(notification)">

    <ng-container [ngSwitch]="notification.type">
      <ng-container *ngSwitchCase="1"> <!-- UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION -->
        <ng-container *ngIf="notification.video; then hasVideo; else noVideo"></ng-container>

        <ng-template #hasVideo>
          <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
            <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" aria-hidden="true"></my-global-icon>

          <div class="message" i18n>
            The notification concerns a video now unavailable
          </div>
        </ng-template>
      </ng-container>

      <ng-container *ngSwitchCase="5"> <!-- UserNotificationType.UNBLACKLIST_ON_MY_VIDEO -->
        <my-global-icon iconName="undo" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          Your video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.video.name }}</a> has been unblocked
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="4"> <!-- UserNotificationType.BLACKLIST_ON_MY_VIDEO -->
        <my-global-icon iconName="no" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          Your video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.videoBlacklist.video.name }}</a> has been blocked
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="3"> <!-- UserNotificationType.NEW_ABUSE_FOR_MODERATORS -->
        <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon>

        <div class="message" *ngIf="notification.videoUrl" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl" [queryParams]="notification.abuseQueryParams">A new video abuse</a> has been created on video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.abuse.video.name }}</a>
        </div>

        <div class="message" *ngIf="notification.commentUrl" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl" [queryParams]="notification.abuseQueryParams">A new comment abuse</a> has been created on video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.abuse.comment.video.name }}</a>
        </div>

        <div class="message" *ngIf="notification.accountUrl" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl" [queryParams]="notification.abuseQueryParams">A new account abuse</a> has been created on account <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.abuse.account.displayName }}</a>
        </div>

        <!-- Deleted entity associated to the abuse -->
        <div class="message" *ngIf="!notification.videoUrl && !notification.commentUrl && !notification.accountUrl" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl" [queryParams]="notification.abuseQueryParams">A new abuse</a> has been created
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="15"> <!-- UserNotificationType.ABUSE_STATE_CHANGE -->
        <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl" [queryParams]="notification.abuseQueryParams">Your abuse {{ notification.abuse.id }}</a> has been
          <ng-container *ngIf="isAccepted(notification)">accepted</ng-container>
          <ng-container *ngIf="!isAccepted(notification)">rejected</ng-container>
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="16"> <!-- UserNotificationType.ABUSE_NEW_MESSAGE -->
        <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl" [queryParams]="notification.abuseQueryParams">Abuse {{ notification.abuse.id }}</a> has a new message
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="12"> <!-- UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS -->
        <my-global-icon iconName="no" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          The recently added video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.videoBlacklist.video.name }}</a> has been <a (click)="markAsRead(notification)" [routerLink]="notification.videoAutoBlacklistUrl">automatically blocked</a>
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="2">
        <ng-container *ngIf="notification.comment">
          <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
            <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-container>

        <ng-container *ngIf="!notification.comment">
          <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon>

          <div class="message" i18n>
            The notification concerns a comment now unavailable
          </div>
        </ng-container>
      </ng-container>

      <ng-container *ngSwitchCase="6"> <!-- UserNotificationType.MY_VIDEO_PUBLISHED -->
        <my-global-icon iconName="film" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          Your video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.video.name }}</a> has been published
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="7"> <!-- UserNotificationType.MY_VIDEO_IMPORT_SUCCESS -->
        <my-global-icon iconName="cloud-download" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl || notification.videoImportUrl">Your video import</a> {{ notification.videoImportIdentifier }} succeeded
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="8"> <!-- UserNotificationType.MY_VIDEO_IMPORT_ERROR -->
        <my-global-icon iconName="cloud-error" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.videoImportUrl">Your video import</a> {{ notification.videoImportIdentifier }} failed
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="9"> <!-- UserNotificationType.NEW_USER_REGISTRATION -->
        <my-global-icon iconName="user-add" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          User <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.account.name }}</a> registered on your instance
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="10"> <!-- UserNotificationType.NEW_FOLLOW -->
        <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
          <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.actorFollow.follower.avatarUrl" />
        </a>

        <div class="message" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.actorFollow.follower.displayName }}</a> is following

          <ng-container *ngIf="notification.actorFollow.following.type === 'channel'">your channel {{ notification.actorFollow.following.displayName }}</ng-container>
          <ng-container *ngIf="notification.actorFollow.following.type === 'account'">your account</ng-container>
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="11">
        <ng-container *ngIf="notification.comment">
          <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
            <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> mentioned you on <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">video {{ notification.comment.video.name }}</a>
          </div>
        </ng-container>

        <ng-container *ngIf="!notification.comment">
          <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon>

          <div class="message" i18n>
            The notification concerns a comment now unavailable
          </div>
        </ng-container>
      </ng-container>

      <ng-container *ngSwitchCase="13"> <!-- UserNotificationType.NEW_INSTANCE_FOLLOWER -->
        <my-global-icon iconName="users" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          Your instance has <a (click)="markAsRead(notification)" [routerLink]="notification.instanceFollowUrl">a new follower</a> ({{ notification.actorFollow?.follower.host }})
          <ng-container *ngIf="notification.actorFollow?.state === 'pending'"> awaiting your approval</ng-container>
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="14"> <!-- UserNotificationType.AUTO_INSTANCE_FOLLOWING -->
        <my-global-icon iconName="users" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          Your instance automatically followed <a (click)="markAsRead(notification)" [routerLink]="notification.instanceFollowUrl">{{ notification.actorFollow.following.host }}</a>
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="17"> <!-- UserNotificationType.NEW_PLUGIN_VERSION -->
        <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          <a (click)="markAsRead(notification)" [routerLink]="notification.pluginUrl" [queryParams]="notification.pluginQueryParams">A new version of the plugin/theme {{ notification.plugin.name }}</a> is available: {{ notification.plugin.latestVersion }}
        </div>
      </ng-container>

      <ng-container *ngSwitchCase="18"> <!-- UserNotificationType.NEW_PEERTUBE_VERSION -->
        <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
            <a (click)="markAsRead(notification)" [href]="notification.peertubeVersionLink" target="_blank" rel="noopener noreferrer">A new version of PeerTube</a> is available: {{ notification.peertube.latestVersion }}
        </div>
      </ng-container>

      <ng-container *ngSwitchDefault>
        <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon>

        <div class="message" i18n>
          The notification points to content now unavailable
        </div>
      </ng-container>
    </ng-container>

    <div [title]="notification.createdAt" class="from-date">{{ notification.createdAt | myFromNow }}</div>
  </div>
</div>