aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-22 17:06:26 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-29 09:32:20 +0200
commit696d83fd1377486dd03cc1bd02a21d9b6ddd9fcd (patch)
treee1b88451c4357add80721f530993e2b48d197feb /server/models/account
parent72c33e716fecd1826dcf645957f8669821f91ff3 (diff)
downloadPeerTube-696d83fd1377486dd03cc1bd02a21d9b6ddd9fcd.tar.gz
PeerTube-696d83fd1377486dd03cc1bd02a21d9b6ddd9fcd.tar.zst
PeerTube-696d83fd1377486dd03cc1bd02a21d9b6ddd9fcd.zip
Block comments from muted accounts/servers
Add better control for users of comments displayed on their videos: * Do not forward comments from muted remote accounts/servers (muted by the current server or by the video owner) * Do not list threads and hide replies (with their children) of accounts/servers muted by the video owner * Hide from RSS comments of muted accounts/servers by video owners Use case: * Try to limit spam propagation in the federation * Add ability for users to automatically hide comments on their videos from undesirable accounts/servers (the comment section belongs to videomakers, so they choose what's posted there)
Diffstat (limited to 'server/models/account')
-rw-r--r--server/models/account/account.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index a0081f259..ad649837a 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -32,9 +32,10 @@ import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequ
32import { AccountBlocklistModel } from './account-blocklist' 32import { AccountBlocklistModel } from './account-blocklist'
33import { ServerBlocklistModel } from '../server/server-blocklist' 33import { ServerBlocklistModel } from '../server/server-blocklist'
34import { ActorFollowModel } from '../activitypub/actor-follow' 34import { ActorFollowModel } from '../activitypub/actor-follow'
35import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable } from '../../typings/models' 35import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../typings/models'
36import * as Bluebird from 'bluebird' 36import * as Bluebird from 'bluebird'
37import { ModelCache } from '@server/models/model-cache' 37import { ModelCache } from '@server/models/model-cache'
38import { VideoModel } from '../video/video'
38 39
39export enum ScopeNames { 40export enum ScopeNames {
40 SUMMARY = 'SUMMARY' 41 SUMMARY = 'SUMMARY'
@@ -343,6 +344,29 @@ export class AccountModel extends Model<AccountModel> {
343 }) 344 })
344 } 345 }
345 346
347 static loadAccountIdFromVideo (videoId: number): Bluebird<MAccount> {
348 const query = {
349 include: [
350 {
351 attributes: [ 'id', 'accountId' ],
352 model: VideoChannelModel.unscoped(),
353 required: true,
354 include: [
355 {
356 attributes: [ 'id', 'channelId' ],
357 model: VideoModel.unscoped(),
358 where: {
359 id: videoId
360 }
361 }
362 ]
363 }
364 ]
365 }
366
367 return AccountModel.findOne(query)
368 }
369
346 static listLocalsForSitemap (sort: string): Bluebird<MAccountActor[]> { 370 static listLocalsForSitemap (sort: string): Bluebird<MAccountActor[]> {
347 const query = { 371 const query = {
348 attributes: [ ], 372 attributes: [ ],