mirror of https://github.com/Chocobozzz/PeerTube
Support search param in URL for video abuses
parent
042daa7072
commit
36004aa7b0
|
@ -1,5 +1,5 @@
|
||||||
<p-table
|
<p-table
|
||||||
[value]="videoAbuses" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
|
[value]="videoAbuses" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
|
||||||
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
|
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
|
||||||
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
|
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
|
||||||
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
|
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
<span class="text-muted">{{ createByString(videoAbuse.reporterAccount) }}</span>
|
<span class="text-muted">{{ createByString(videoAbuse.reporterAccount) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a routerLink="/admin/moderation/video-abuses/list" class="ml-auto text-muted video-details-links" i18n>
|
<a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': videoAbuse.reporterAccount.displayName }" class="ml-auto text-muted video-details-links" i18n>
|
||||||
{videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
|
{videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
<span class="text-muted">{{ videoAbuse.video.channel.ownerAccount ? createByString(videoAbuse.video.channel.ownerAccount) : '' }}</span>
|
<span class="text-muted">{{ videoAbuse.video.channel.ownerAccount ? createByString(videoAbuse.video.channel.ownerAccount) : '' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a routerLink="/admin/moderation/video-abuses/list" class="ml-auto text-muted video-details-links" *ngIf="!videoAbuse.video.deleted" i18n>
|
<a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': videoAbuse.video.channel.ownerAccount.displayName }" class="ml-auto text-muted video-details-links" *ngIf="!videoAbuse.video.deleted" i18n>
|
||||||
{videoAbuse.countReportsForReportee, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReportee }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
|
{videoAbuse.countReportsForReportee, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReportee }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, ViewChild } from '@angular/core'
|
import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'
|
||||||
import { Account } from '@app/shared/account/account.model'
|
import { Account } from '@app/shared/account/account.model'
|
||||||
import { Notifier } from '@app/core'
|
import { Notifier } from '@app/core'
|
||||||
import { SortMeta } from 'primeng/api'
|
import { SortMeta } from 'primeng/api'
|
||||||
|
@ -17,14 +17,14 @@ import { DomSanitizer } from '@angular/platform-browser'
|
||||||
import { BlocklistService } from '@app/shared/blocklist'
|
import { BlocklistService } from '@app/shared/blocklist'
|
||||||
import { VideoService } from '@app/shared/video/video.service'
|
import { VideoService } from '@app/shared/video/video.service'
|
||||||
import { ActivatedRoute } from '@angular/router'
|
import { ActivatedRoute } from '@angular/router'
|
||||||
import { first } from 'rxjs/operators'
|
import { filter } from 'rxjs/operators'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-abuse-list',
|
selector: 'my-video-abuse-list',
|
||||||
templateUrl: './video-abuse-list.component.html',
|
templateUrl: './video-abuse-list.component.html',
|
||||||
styleUrls: [ '../moderation.component.scss', './video-abuse-list.component.scss' ]
|
styleUrls: [ '../moderation.component.scss', './video-abuse-list.component.scss' ]
|
||||||
})
|
})
|
||||||
export class VideoAbuseListComponent extends RestTable implements OnInit {
|
export class VideoAbuseListComponent extends RestTable implements OnInit, AfterViewInit {
|
||||||
@ViewChild('moderationCommentModal', { static: true }) moderationCommentModal: ModerationCommentModalComponent
|
@ViewChild('moderationCommentModal', { static: true }) moderationCommentModal: ModerationCommentModalComponent
|
||||||
|
|
||||||
videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = []
|
videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = []
|
||||||
|
@ -190,8 +190,16 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
|
|
||||||
this.route.queryParams
|
this.route.queryParams
|
||||||
.pipe(first(params => params.search !== undefined && params.search !== null))
|
.pipe(filter(params => params.search !== undefined && params.search !== null))
|
||||||
.subscribe(params => this.search = params.search)
|
.subscribe(params => {
|
||||||
|
this.search = params.search
|
||||||
|
this.setTableFilter(params.search)
|
||||||
|
this.loadData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit () {
|
||||||
|
this.setTableFilter(this.search)
|
||||||
}
|
}
|
||||||
|
|
||||||
getIdentifier () {
|
getIdentifier () {
|
||||||
|
@ -210,6 +218,11 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
|
||||||
return Account.CREATE_BY_STRING(account.name, account.host)
|
return Account.CREATE_BY_STRING(account.name, account.host)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTableFilter (filter: string) {
|
||||||
|
const filterInput = document.getElementById('table-filter') as HTMLInputElement
|
||||||
|
if (filterInput) filterInput.value = filter
|
||||||
|
}
|
||||||
|
|
||||||
isVideoAbuseAccepted (videoAbuse: VideoAbuse) {
|
isVideoAbuseAccepted (videoAbuse: VideoAbuse) {
|
||||||
return videoAbuse.state.id === VideoAbuseState.ACCEPTED
|
return videoAbuse.state.id === VideoAbuseState.ACCEPTED
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.route.queryParams
|
this.route.queryParams
|
||||||
.pipe(first(params => params.search !== undefined && params.search !== null))
|
.pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null))
|
||||||
.subscribe(params => this.search = params.search)
|
.subscribe(params => this.search = params.search)
|
||||||
this.serverService.getConfig()
|
this.serverService.getConfig()
|
||||||
.subscribe(config => this.serverConfig = config)
|
.subscribe(config => this.serverConfig = config)
|
||||||
|
@ -146,11 +146,15 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isOnSearch () {
|
||||||
|
return window.location.pathname === '/search'
|
||||||
|
}
|
||||||
|
|
||||||
doSearch () {
|
doSearch () {
|
||||||
this.newSearch = false
|
this.newSearch = false
|
||||||
const queryParams: Params = {}
|
const queryParams: Params = {}
|
||||||
|
|
||||||
if (window.location.pathname === '/search' && this.route.snapshot.queryParams) {
|
if (this.isOnSearch() && this.route.snapshot.queryParams) {
|
||||||
Object.assign(queryParams, this.route.snapshot.queryParams)
|
Object.assign(queryParams, this.route.snapshot.queryParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue