mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
NoteにisSensitive
This commit is contained in:
parent
1c4e1af7c3
commit
3d5bcfbaf0
13
migration/1566733587544-NoteSensitive.ts
Normal file
13
migration/1566733587544-NoteSensitive.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
|
||||
export class NoteSensitive1566733587544 implements MigrationInterface {
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "note" ADD "isSensitive" boolean NOT NULL DEFAULT false`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "isSensitive"`);
|
||||
}
|
||||
|
||||
}
|
@ -83,6 +83,12 @@ export class Note {
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
comment: 'Whether the Note is NSFW.'
|
||||
})
|
||||
public isSensitive: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false
|
||||
})
|
||||
|
@ -158,7 +158,7 @@ export default async function renderNote(note: Note, dive = true): Promise<any>
|
||||
cc,
|
||||
inReplyTo,
|
||||
attachment: files.map(renderDocument),
|
||||
sensitive: files.some(file => file.isSensitive),
|
||||
sensitive: note.isSensitive || files.some(file => file.isSensitive),
|
||||
tag,
|
||||
...asPoll
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ export const meta = {
|
||||
validator: $.optional.bool,
|
||||
default: false,
|
||||
desc: {
|
||||
'ja-JP': 'true にすると、NSFW指定されたファイルを除外します(fileTypeが指定されている場合のみ有効)'
|
||||
'ja-JP': 'true にすると、NSFW指定されたコンテンツを除外します'
|
||||
}
|
||||
},
|
||||
|
||||
@ -110,15 +110,10 @@ export default define(meta, async (ps, user) => {
|
||||
qb.orWhere(`:type${i} = ANY(note.attachedFileTypes)`, { [`type${i}`]: type });
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (ps.excludeNsfw) {
|
||||
// v11 TODO
|
||||
/*
|
||||
query['_files.isSensitive'] = {
|
||||
$ne: true
|
||||
};
|
||||
*/
|
||||
}
|
||||
if (ps.excludeNsfw) {
|
||||
query.andWhere('note.isSensitive = FALSE');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
@ -113,7 +113,7 @@ export const meta = {
|
||||
validator: $.optional.bool,
|
||||
default: false,
|
||||
desc: {
|
||||
'ja-JP': 'true にすると、NSFW指定されたファイルを除外します(fileTypeが指定されている場合のみ有効)'
|
||||
'ja-JP': 'true にすると、NSFW指定されたコンテンツを除外します'
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -164,13 +164,10 @@ export default define(meta, async (ps, me) => {
|
||||
qb.orWhere(`:type${i} = ANY(note.attachedFileTypes)`, { [`type${i}`]: type });
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (ps.excludeNsfw) {
|
||||
// v11 TODO
|
||||
/*query['_files.isSensitive'] = {
|
||||
$ne: true
|
||||
};*/
|
||||
}
|
||||
if (ps.excludeNsfw) {
|
||||
query.andWhere('note.isSensitive = FALSE');
|
||||
}
|
||||
|
||||
if (!ps.includeReplies) {
|
||||
|
@ -357,6 +357,7 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri
|
||||
tags: tags.map(tag => tag.toLowerCase()),
|
||||
emojis,
|
||||
userId: user.id,
|
||||
isSensitive: data.cw != null || (data.files ? data.files.some(file => file.isSensitive) : false),
|
||||
viaMobile: data.viaMobile!,
|
||||
localOnly: data.localOnly!,
|
||||
geo: data.geo || null,
|
||||
|
Loading…
Reference in New Issue
Block a user