Add links from user-edit
This commit is contained in:
parent
197876ea87
commit
d1261d9a3c
5 changed files with 60 additions and 15 deletions
|
@ -217,6 +217,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV
|
||||||
}
|
}
|
||||||
|
|
||||||
setTableFilter (filter: string) {
|
setTableFilter (filter: string) {
|
||||||
|
// FIXME: cannot use ViewChild, so create a component for the filter input
|
||||||
const filterInput = document.getElementById('table-filter') as HTMLInputElement
|
const filterInput = document.getElementById('table-filter') as HTMLInputElement
|
||||||
if (filterInput) filterInput.value = filter
|
if (filterInput) filterInput.value = filter
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a>
|
<a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': user?.account.displayName }">
|
||||||
<div class="dashboard-num">{{ user.videoAbusesCount }}</div>
|
<div class="dashboard-num">{{ user.videoAbusesCount }}</div>
|
||||||
<div class="dashboard-label" i18n>Incriminated in reports</div>
|
<div class="dashboard-label" i18n>Incriminated in reports</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a>
|
<a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': user?.account.displayName }">
|
||||||
<div class="dashboard-num">{{ user.videoAbusesAcceptedCount }} / {{ user.videoAbusesCreatedCount }}</div>
|
<div class="dashboard-num">{{ user.videoAbusesAcceptedCount }} / {{ user.videoAbusesCreatedCount }}</div>
|
||||||
<div class="dashboard-label" i18n>Authored reports accepted</div>
|
<div class="dashboard-label" i18n>Authored reports accepted</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -692,6 +692,8 @@
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
& > a {
|
& > a {
|
||||||
|
@include disable-default-a-behaviour;
|
||||||
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -14,7 +14,9 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateVideoAbuse,
|
updateVideoAbuse,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
removeVideo
|
removeVideo,
|
||||||
|
createUser,
|
||||||
|
userLogin
|
||||||
} from '../../../../shared/extra-utils/index'
|
} from '../../../../shared/extra-utils/index'
|
||||||
import { doubleFollow } from '../../../../shared/extra-utils/server/follows'
|
import { doubleFollow } from '../../../../shared/extra-utils/server/follows'
|
||||||
import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
|
import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
|
||||||
|
@ -236,16 +238,56 @@ describe('Test video abuses', function () {
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
{
|
const res = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
|
||||||
const res = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
|
expect(res.body.total).to.equal(2, "wrong number of videos returned")
|
||||||
expect(res.body.total).to.equal(2)
|
expect(res.body.data.length).to.equal(2, "wrong number of videos returned")
|
||||||
expect(res.body.data.length).to.equal(2)
|
expect(res.body.data[0].id).to.equal(abuseServer2.id, "wrong origin server id for first video")
|
||||||
expect(res.body.data[0].id).to.equal(abuseServer2.id)
|
|
||||||
|
|
||||||
const abuse: VideoAbuse = res.body.data[1]
|
const abuse: VideoAbuse = res.body.data[0]
|
||||||
expect(abuse.video.deleted).to.be.true
|
expect(abuse.video.id).to.equal(abuseServer2.video.id, "wrong video id")
|
||||||
expect(abuse.video.id).to.equal(abuseServer2.video.id)
|
expect(abuse.video.channel).to.exist
|
||||||
expect(abuse.video.channel).to.exist
|
expect(abuse.video.deleted).to.be.true
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should include counts of reports from reporter and reportee', async function () {
|
||||||
|
this.timeout(10000)
|
||||||
|
|
||||||
|
// register a second user to have two reporters/reportees
|
||||||
|
const user = { username: 'user2', password: 'password' }
|
||||||
|
await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, ...user })
|
||||||
|
const userAccessToken = await userLogin(servers[0], user)
|
||||||
|
|
||||||
|
// upload a third video via this user
|
||||||
|
const video3Attributes = {
|
||||||
|
name: 'my second super name for server 1',
|
||||||
|
description: 'my second super description for server 1'
|
||||||
|
}
|
||||||
|
await uploadVideo(servers[0].url, userAccessToken, video3Attributes)
|
||||||
|
|
||||||
|
const res1 = await getVideosList(servers[0].url)
|
||||||
|
const videos = res1.body.data
|
||||||
|
const video3 = videos.find(video => video.name === 'my second super name for server 1')
|
||||||
|
|
||||||
|
// resume with the test
|
||||||
|
const reason3 = 'my super bad reason 3'
|
||||||
|
await reportVideoAbuse(servers[0].url, servers[0].accessToken, video3.id, reason3)
|
||||||
|
const reason4 = 'my super bad reason 4'
|
||||||
|
await reportVideoAbuse(servers[0].url, userAccessToken, servers[0].video.id, reason4)
|
||||||
|
|
||||||
|
const res2 = await getVideoAbusesList(servers[0].url, servers[0].accessToken)
|
||||||
|
|
||||||
|
{
|
||||||
|
for (const abuse of res2.body.data as VideoAbuse[]) {
|
||||||
|
if (abuse.video.id === video3.id) {
|
||||||
|
expect(abuse.count).to.equal(1, "wrong reports count for video 3")
|
||||||
|
expect(abuse.nth).to.equal(1, "wrong report position in report list for video 3")
|
||||||
|
expect(abuse.countReportsForReportee).to.equal(1, "wrong reports count for reporter on video 3 abuse")
|
||||||
|
expect(abuse.countReportsForReporter).to.equal(3, "wrong reports count for reportee on video 3 abuse")
|
||||||
|
}
|
||||||
|
if (abuse.video.id === servers[0].video.id) {
|
||||||
|
expect(abuse.countReportsForReportee).to.equal(3, "wrong reports count for reporter on video 1 abuse")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -265,7 +307,7 @@ describe('Test video abuses', function () {
|
||||||
|
|
||||||
{
|
{
|
||||||
const res = await getVideoAbusesList(servers[0].url, servers[0].accessToken)
|
const res = await getVideoAbusesList(servers[0].url, servers[0].accessToken)
|
||||||
expect(res.body.total).to.equal(3)
|
expect(res.body.total).to.equal(5)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { VideoAbuseModel } from '../../../models/video/video-abuse'
|
import { VideoAbuseModel } from '../../../models/video/video-abuse'
|
||||||
import { PickWith } from '../../utils'
|
import { PickWith } from '../../utils'
|
||||||
import { MVideoAccountLightBlacklistAllFiles } from './video'
|
import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
|
||||||
import { MAccountDefault, MAccountFormattable } from '../account'
|
import { MAccountDefault, MAccountFormattable } from '../account'
|
||||||
|
|
||||||
type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
|
type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
|
||||||
|
@ -16,7 +16,7 @@ export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
|
||||||
export type MVideoAbuseVideo =
|
export type MVideoAbuseVideo =
|
||||||
MVideoAbuse &
|
MVideoAbuse &
|
||||||
Pick<VideoAbuseModel, 'toActivityPubObject'> &
|
Pick<VideoAbuseModel, 'toActivityPubObject'> &
|
||||||
Use<'Video', MVideoAccountLightBlacklistAllFiles>
|
Use<'Video', MVideo>
|
||||||
|
|
||||||
export type MVideoAbuseAccountVideo =
|
export type MVideoAbuseAccountVideo =
|
||||||
MVideoAbuse &
|
MVideoAbuse &
|
||||||
|
|
Loading…
Reference in a new issue