1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00
Peertube/server/core/initializers/migrations/0895-nsfw-flags.ts
Chocobozzz dd4027a10f
Improve NSFW system
* Add NSFW flags to videos so the publisher can add more NSFW context
 * Add NSFW summary to videos, similar to content warning system so the
   publisher has a free text to describe NSFW aspect of its video
 * Add additional "warn" NSFW policy: the video thumbnail is not blurred
   and we display a tag below the video miniature, the video player
   includes the NSFW warning (with context if available) and it also
   prevent autoplay
 * "blur" NSFW settings inherits "warn" policy and also blur the video
   thumbnail
 * Add NSFW flag settings to users so they can have more granular
   control about what content they want to hide, warn or display
2025-04-30 15:54:11 +02:00

58 lines
1.3 KiB
TypeScript

import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
const { transaction } = utils
{
await utils.queryInterface.addColumn('video', 'nsfwSummary', {
type: Sequelize.STRING,
defaultValue: null,
allowNull: true
}, { transaction })
await utils.queryInterface.addColumn('video', 'nsfwFlags', {
type: Sequelize.INTEGER,
defaultValue: 0,
allowNull: false
}, { transaction })
}
{
await utils.queryInterface.addColumn('user', 'nsfwFlagsDisplayed', {
type: Sequelize.INTEGER,
defaultValue: 0,
allowNull: false
}, { transaction })
await utils.queryInterface.addColumn('user', 'nsfwFlagsHidden', {
type: Sequelize.INTEGER,
defaultValue: 0,
allowNull: false
}, { transaction })
await utils.queryInterface.addColumn('user', 'nsfwFlagsWarned', {
type: Sequelize.INTEGER,
defaultValue: 0,
allowNull: false
}, { transaction })
await utils.queryInterface.addColumn('user', 'nsfwFlagsBlurred', {
type: Sequelize.INTEGER,
defaultValue: 0,
allowNull: false
}, { transaction })
}
}
function down (options) {
throw new Error('Not implemented.')
}
export {
down,
up
}