Only show updatedAt date of abuse if different from createdAt
[oweals/peertube.git] / client / src / app / +admin / moderation / video-abuse-list / video-abuse-list.component.html
1 <p-table
2   [value]="videoAbuses" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
3   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
4   [showCurrentPageReport]="true" i18n-currentPageReportTemplate
5   currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
6   (onPage)="onPage()" [expandedRowKeys]="expandedRows"
7 >
8   <ng-template pTemplate="caption">
9     <div class="caption">
10       <div class="ml-auto">
11         <div class="input-group">
12           <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body">
13             <div class="input-group-text" ngbDropdownToggle>
14               <span class="caret" aria-haspopup="menu" role="button"></span>
15             </div>
16
17             <div role="menu" ngbDropdownMenu>
18               <h6 class="dropdown-header" i18n>Filter reports</h6>
19
20               <!-- TODO:
21               <div class="dropdown-item" i18n>Reports opened by admins</div>
22               <div class="dropdown-item" i18n>Reports on videos with multiple reports</div>
23               <div class="dropdown-item" i18n>Unassigned reports</div>
24               -->
25               <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:pending' }" class="dropdown-item" i18n>Unsolved reports</a>
26               <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:accepted' }" class="dropdown-item" i18n>Accepted reports</a>
27               <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:rejected' }" class="dropdown-item" i18n>Refused reports</a>
28               <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'is:blacklisted' }" class="dropdown-item" i18n>Reports with blacklisted videos</a>
29               <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'is:deleted' }" class="dropdown-item" i18n>Reports with deleted videos</a>
30             </div>
31           </div>
32           <input
33             type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
34             (keyup)="onSearch($event)"
35           >
36         </div>
37       </div>
38     </div>
39   </ng-template>
40
41   <ng-template pTemplate="header">
42     <tr> <!-- header -->
43       <th style="width: 40px;"></th>
44       <th style="width: 20%;" pResizableColumn i18n>Reporter</th>
45       <th i18n>Video</th>
46       <th style="width: 140px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
47       <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th>
48       <th style="width: 120px;"></th>
49     </tr>
50   </ng-template>
51
52   <ng-template pTemplate="body" let-expanded="expanded" let-videoAbuse>
53     <tr>
54       <td class="c-hand" [pRowToggler]="videoAbuse" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body">
55         <span class="expander">
56           <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
57         </span>
58       </td>
59
60       <td>
61         <a [href]="videoAbuse.reporterAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer">
62           <div class="chip two-lines">
63             <img
64               class="avatar"
65               [src]="videoAbuse.reporterAccount.avatar?.path"
66               (error)="switchToDefaultAvatar($event)"
67               alt="Avatar"
68             >
69             <div>
70               {{ videoAbuse.reporterAccount.displayName }}
71               <span class="text-muted">{{ createByString(videoAbuse.reporterAccount) }}</span>
72             </div>
73           </div>
74         </a>
75       </td>
76
77       <td *ngIf="!videoAbuse.video.deleted">
78         <a [href]="getVideoUrl(videoAbuse)" class="video-table-video-link" i18n-title title="Open video in a new tab" target="_blank" rel="noopener noreferrer">
79           <div class="video-table-video">
80             <div class="video-table-video-image">
81               <img [src]="videoAbuse.video.thumbnailPath">
82               <span
83                 class="video-table-video-image-label" *ngIf="videoAbuse.count > 1"
84                 i18n-title title="This video has been reported multiple times."
85               >
86                 {{ videoAbuse.nth }}/{{ videoAbuse.count }}
87               </span>
88             </div>
89             <div class="video-table-video-text">
90               <div>
91                 {{ videoAbuse.video.name }}
92                 <span *ngIf="!videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span>
93                 <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span>
94               </div>
95               <div class="text-muted" i18n>by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>
96             </div>
97           </div>
98         </a>
99       </td>
100
101       <td *ngIf="videoAbuse.video.deleted" class="c-hand" [pRowToggler]="videoAbuse">
102         <div class="video-table-video" i18n-title title="Video was deleted">
103           <div class="video-table-video-image">
104             <span i18n>Deleted</span>
105           </div>
106           <div class="video-table-video-text">
107             <div>
108               {{ videoAbuse.video.name }}
109               <span class="glyphicon glyphicon-trash"></span>
110             </div>
111             <div class="text-muted" i18n>by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>
112           </div>
113         </div>
114       </td>
115
116       <td class="c-hand" [pRowToggler]="videoAbuse">{{ videoAbuse.createdAt | date: 'short'  }}</td>
117
118       <td class="c-hand video-abuse-states" [pRowToggler]="videoAbuse">
119         <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span>
120         <span *ngIf="isVideoAbuseRejected(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-remove"></span>
121         <span *ngIf="videoAbuse.moderationComment" container="body" placement="left auto" [ngbTooltip]="videoAbuse.moderationComment" class="glyphicon glyphicon-comment"></span>
122       </td>
123
124       <td class="action-cell">
125         <my-action-dropdown
126           [ngClass]="{ 'show': expanded }" placement="bottom-right top-right left auto" container="body"
127           i18n-label label="Actions" [actions]="videoAbuseActions" [entry]="videoAbuse"
128         ></my-action-dropdown>
129       </td>
130     </tr>
131   </ng-template>
132
133   <ng-template pTemplate="rowexpansion" let-videoAbuse>
134       <tr>
135         <td class="expand-cell" colspan="6">
136           <div class="d-flex moderation-expanded">
137             <!-- report left part (report details) -->
138             <div class="col-8">
139
140               <!-- report metadata -->
141               <div class="d-flex">
142                 <span class="col-3 moderation-expanded-label" i18n>Reporter</span>
143                 <span class="col-9 moderation-expanded-text">
144                   <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reporter:&quot;' + videoAbuse.reporterAccount.displayName + '&quot;' }" class="chip">
145                     <img
146                       class="avatar"
147                       [src]="videoAbuse.reporterAccount.avatar.path"
148                       (error)="switchToDefaultAvatar($event)"
149                       alt="Avatar"
150                     >
151                     <div>
152                       <span class="text-muted">{{ createByString(videoAbuse.reporterAccount) }}</span>
153                     </div>
154                   </a>
155                   <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reportee:&quot;' + videoAbuse.reporterAccount.displayName + '&quot;' }" class="ml-auto text-muted video-details-links" i18n>
156                     {videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
157                   </a>
158                 </span>
159               </div>
160
161               <div class="d-flex">
162                 <span class="col-3 moderation-expanded-label" i18n>Reportee</span>
163                 <span class="col-9 moderation-expanded-text">
164                   <div class="chip">
165                     <img
166                       class="avatar"
167                       [src]="videoAbuse.video.channel.ownerAccount?.avatar.path"
168                       (error)="switchToDefaultAvatar($event)"
169                       alt="Avatar"
170                     >
171                     <div>
172                       <span class="text-muted">{{ videoAbuse.video.channel.ownerAccount ? createByString(videoAbuse.video.channel.ownerAccount) : '' }}</span>
173                     </div>
174                   </div>
175                   <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reportee:&quot;' +videoAbuse.video.channel.ownerAccount.displayName + '&quot;' }" class="ml-auto text-muted video-details-links" i18n>
176                     {videoAbuse.countReportsForReportee, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReportee }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
177                   </a>
178                 </span>
179               </div>
180
181               <div class="d-flex">
182                 <span class="col-3 moderation-expanded-label" i18n>Updated</span>
183                 <time class="col-9 moderation-expanded-text video-details-date-updated">{{ videoAbuse.updatedAt | date: 'medium' }}</time>
184               </div>
185
186               <!-- report text -->
187               <div class="mt-3 d-flex">
188                 <span class="col-3 moderation-expanded-label" i18n>Report #{{ videoAbuse.id }}</span>
189                 <span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.reasonHtml"></span>
190               </div>
191
192               <div class="mt-3 d-flex" *ngIf="videoAbuse.moderationComment">
193                 <span class="col-3 moderation-expanded-label" i18n>Note</span>
194                 <span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.moderationCommentHtml"></span>
195               </div>
196
197             </div>
198
199             <!-- report right part (video details) -->
200             <div class="col-4">
201               <div class="screenratio">
202                 <div *ngIf="videoAbuse.video.deleted || videoAbuse.video.blacklisted">
203                   <span i18n *ngIf="videoAbuse.video.deleted">The video was deleted</span>
204                   <span i18n *ngIf="!videoAbuse.video.deleted">The video was blacklisted</span>
205                 </div>
206                 <div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div>
207               </div>
208             </div>
209           </div>
210         </td>
211       </tr>
212   </ng-template>
213
214   <ng-template pTemplate="emptymessage">
215     <tr>
216       <td colspan="6">
217         <div class="empty-table-message">
218           <ng-container *ngIf="search" i18n>No video abuses found matching current filters.</ng-container>
219           <ng-container *ngIf="!search" i18n>No video abuses found.</ng-container>
220         </div>
221       </td>
222     </tr>
223   </ng-template>
224 </p-table>
225
226 <my-moderation-comment-modal #moderationCommentModal (commentUpdated)="onModerationCommentUpdated()"></my-moderation-comment-modal>