aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
blob: d90b93fff61ae260fe954b475e793faf1d401dec (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
<p-table
  [value]="abuses" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
  [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true" [lazyLoadOnInit]="false"
  [showCurrentPageReport]="true" i18n-currentPageReportTemplate
  currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
  (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
>
  <ng-template pTemplate="caption">
    <div class="caption">
      <div class="ml-auto">
        <div class="input-group has-feedback has-clear">
          <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body">
            <div class="input-group-text" ngbDropdownToggle>
              <span class="caret" aria-haspopup="menu" role="button"></span>
            </div>

            <div role="menu" ngbDropdownMenu>
              <h6 class="dropdown-header" i18n>Advanced report filters</h6>
              <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'state:pending' }" class="dropdown-item" i18n>Unsolved reports</a>
              <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'state:accepted' }" class="dropdown-item" i18n>Accepted reports</a>
              <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'state:rejected' }" class="dropdown-item" i18n>Refused reports</a>
              <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'videoIs:blacklisted' }" class="dropdown-item" i18n>Reports with blocked videos</a>
              <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'videoIs:deleted' }" class="dropdown-item" i18n>Reports with deleted videos</a>
            </div>
          </div>
          <input
            type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
            (keyup)="onAbuseSearch($event)"
          >
          <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a>
          <span class="sr-only" i18n>Clear filters</span>
        </div>
      </div>
    </div>
  </ng-template>

  <ng-template pTemplate="header">
    <tr> <!-- header -->
      <th style="width: 40px;"></th>
      <th *ngIf="isAdminView()" style="width: 20%;" pResizableColumn i18n>Reporter</th>
      <th i18n>Video/Comment/Account</th>
      <th style="width: 150px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
      <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th>
      <th i18n style="width: 80px;">Messages</th>
      <th i18n *ngIf="isAdminView()" style="width: 100px;">Internal note</th>
      <th style="width: 150px;"></th>
    </tr>
  </ng-template>

  <ng-template pTemplate="body" let-expanded="expanded" let-abuse>
    <tr>
      <td class="c-hand" [pRowToggler]="abuse" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body">
        <span class="expander">
          <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
        </span>
      </td>

      <td *ngIf="isAdminView()">
        <a *ngIf="abuse.reporterAccount" [href]="abuse.reporterAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer">
          <div class="chip two-lines">
            <img
              class="avatar"
              [src]="abuse.reporterAccount.avatar?.path"
              (error)="switchToDefaultAvatar($event)"
              alt="Avatar"
            >
            <div>
              {{ abuse.reporterAccount.displayName }}
              <span>{{ abuse.reporterAccount.nameWithHost }}</span>
            </div>
          </div>
        </a>

        <span i18n *ngIf="!abuse.reporterAccount">
          Deleted account
        </span>
      </td>

      <ng-container *ngIf="abuse.video">

        <td *ngIf="!abuse.video.deleted">
          <a [href]="getVideoUrl(abuse)" class="table-video-link" [title]="abuse.video.name" target="_blank" rel="noopener noreferrer">
            <div class="table-video">
              <div class="table-video-image">
                <img [src]="abuse.video.thumbnailPath">
                <span
                  class="table-video-image-label" *ngIf="abuse.count > 1"
                  i18n-title title="This video has been reported multiple times."
                >
                  {{ abuse.nth }}/{{ abuse.count }}
                </span>
              </div>

              <div class="table-video-text">
                <div>
                  <span *ngIf="!abuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span>
                  <span *ngIf="abuse.video.blacklisted" i18n-title title="The video was blocked" class="glyphicon glyphicon-ban-circle"></span>
                  {{ abuse.video.name }}
                </div>
                <div i18n>by {{ abuse.video.channel?.displayName }} on {{ abuse.video.channel?.host }} </div>
              </div>
            </div>
          </a>
        </td>

        <td *ngIf="abuse.video.deleted" class="c-hand" [pRowToggler]="abuse">
          <div class="table-video" i18n-title title="Video was deleted">
            <div class="table-video-image">
              <span i18n>Deleted</span>
            </div>

            <div class="table-video-text">
              <div>
                {{ abuse.video.name }}
                <span class="glyphicon glyphicon-trash"></span>
              </div>
              <div i18n>by {{ abuse.video.channel?.displayName }} on {{ abuse.video.channel?.host }} </div>
            </div>
          </div>
        </td>
      </ng-container>

      <ng-container *ngIf="abuse.comment">
        <td>
          <a [href]="getCommentUrl(abuse)" [innerHTML]="abuse.truncatedCommentHtml" class="table-comment-link"
            [title]="abuse.comment.video.name" target="_blank" rel="noopener noreferrer"
          ></a>

          <div class="comment-flagged-account" *ngIf="abuse.flaggedAccount">by {{ abuse.flaggedAccount.displayName }}</div>
        </td>
      </ng-container>

      <ng-container *ngIf="!abuse.comment && !abuse.video">
        <td *ngIf="abuse.flaggedAccount">
          <a [href]="getAccountUrl(abuse)"  class="table-account-link" target="_blank" rel="noopener noreferrer">
            <span>{{ abuse.flaggedAccount.displayName }}</span>

            <span class="account-flagged-handle">{{ abuse.flaggedAccount.nameWithHostForced }}</span>
          </a>
        </td>

        <td i18n *ngIf="!abuse.flaggedAccount">
          Account deleted
        </td>

      </ng-container>

      <td class="c-hand" [pRowToggler]="abuse">{{ abuse.createdAt | date: 'short'  }}</td>

      <td class="c-hand abuse-states" [pRowToggler]="abuse">
        <span *ngIf="isAbuseAccepted(abuse)" [title]="abuse.state.label" class="glyphicon glyphicon-ok"></span>
        <span *ngIf="isAbuseRejected(abuse)" [title]="abuse.state.label" class="glyphicon glyphicon-remove"></span>
      </td>

      <td class="c-hand abuse-messages" (click)="openAbuseMessagesModal(abuse)">
        <ng-container *ngIf="isLocalAbuse(abuse)">
          {{ abuse.countMessages }}

          <my-global-icon iconName="message-circle"></my-global-icon>
        </ng-container>
      </td>

      <td *ngIf="isAdminView()" class="internal-note" container="body" placement="left auto" [ngbTooltip]="abuse.moderationComment">
        {{ abuse.moderationComment }}
      </td>

      <td class="action-cell">
        <my-action-dropdown
          [ngClass]="{ 'show': expanded }" placement="bottom-right top-right left auto" container="body"
          i18n-label label="Actions" [actions]="abuseActions" [entry]="abuse"
        ></my-action-dropdown>
      </td>
    </tr>
  </ng-template>

  <ng-template pTemplate="rowexpansion" let-abuse>
      <tr>
        <td class="expand-cell" colspan="6">
          <my-abuse-details [abuse]="abuse" [baseRoute]="baseRoute" [isAdminView]="isAdminView()"></my-abuse-details>
        </td>
      </tr>
  </ng-template>

  <ng-template pTemplate="emptymessage">
    <tr>
      <td colspan="6">
        <div class="no-results">
          <ng-container *ngIf="search" i18n>No abuses found matching current filters.</ng-container>
          <ng-container *ngIf="!search" i18n>No abuses found.</ng-container>
        </div>
      </td>
    </tr>
  </ng-template>
</p-table>

<my-moderation-comment-modal #moderationCommentModal (commentUpdated)="onModerationCommentUpdated()"></my-moderation-comment-modal>
<my-abuse-message-modal #abuseMessagesModal [isAdminView]="isAdminView()" (countMessagesUpdated)="onCountMessagesUpdated($event)"></my-abuse-message-modal>