From 0883b3245bf0deb9106c4041e9afbd3521b79280 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Apr 2018 11:01:34 +0200 Subject: Add ability to choose what policy we have for NSFW videos There is a global instance setting and a per user setting --- shared/models/server/custom-config.model.ts | 3 +++ shared/models/server/server-config.model.ts | 3 +++ shared/models/users/user-update-me.model.ts | 4 +++- shared/models/users/user.model.ts | 3 ++- shared/models/videos/nsfw-policy.type.ts | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 shared/models/videos/nsfw-policy.type.ts (limited to 'shared/models') diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index b4d24cfbe..30956bd47 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -1,3 +1,5 @@ +import { NSFWPolicyType } from '../videos/nsfw-policy.type' + export interface CustomConfig { instance: { name: string @@ -5,6 +7,7 @@ export interface CustomConfig { description: string terms: string defaultClientRoute: string + defaultNSFWPolicy: NSFWPolicyType customizations: { javascript?: string css?: string diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 611d0efe5..d1f956163 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -1,3 +1,5 @@ +import { NSFWPolicyType } from '../videos/nsfw-policy.type' + export interface ServerConfig { serverVersion: string @@ -5,6 +7,7 @@ export interface ServerConfig { name: string shortDescription: string defaultClientRoute: string + defaultNSFWPolicy: NSFWPolicyType customizations: { javascript: string css: string diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index b84233329..0a73879ed 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts @@ -1,6 +1,8 @@ +import { NSFWPolicyType } from '../videos/nsfw-policy.type' + export interface UserUpdateMe { description?: string - displayNSFW?: boolean + nsfwPolicy?: NSFWPolicyType autoPlayVideo?: boolean email?: string password?: string diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index b5f459f31..188e29ede 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -1,12 +1,13 @@ import { Account } from '../actors' import { VideoChannel } from '../videos/video-channel.model' import { UserRole } from './user-role' +import { NSFWPolicyType } from '../videos/nsfw-policy.type' export interface User { id: number username: string email: string - displayNSFW: boolean + nsfwPolicy: NSFWPolicyType autoPlayVideo: boolean role: UserRole videoQuota: number diff --git a/shared/models/videos/nsfw-policy.type.ts b/shared/models/videos/nsfw-policy.type.ts new file mode 100644 index 000000000..dc0032a14 --- /dev/null +++ b/shared/models/videos/nsfw-policy.type.ts @@ -0,0 +1 @@ +export type NSFWPolicyType = 'do_not_list' | 'blur' | 'display' -- cgit v1.2.3