Hide NSFW in Photos (#3875)

This commit is contained in:
MeiMei 2019-01-11 08:10:39 +09:00 committed by syuilo
parent e5782a7c30
commit 65e34cef83
4 changed files with 18 additions and 0 deletions

View file

@ -169,6 +169,7 @@ export default Vue.extend({
this.$root.api('users/notes', {
userId: this.user.id,
fileType: image,
excludeNsfw: !this.$store.state.device.alwaysShowNsfw,
limit: 9,
untilDate: new Date().getTime() + 1000 * 86400 * 365
}).then(notes => {

View file

@ -29,9 +29,11 @@ export default Vue.extend({
'image/png',
'image/gif'
];
this.$root.api('users/notes', {
userId: this.user.id,
fileType: image,
excludeNsfw: !this.$store.state.device.alwaysShowNsfw,
limit: 9,
untilDate: new Date().getTime() + 1000 * 86400 * 365
}).then(notes => {

View file

@ -34,6 +34,7 @@ export default Vue.extend({
this.$root.api('users/notes', {
userId: this.user.id,
fileType: image,
excludeNsfw: !this.$store.state.device.alwaysShowNsfw,
limit: 9,
untilDate: new Date().getTime() + 1000 * 86400 * 365
}).then(notes => {

View file

@ -124,6 +124,14 @@ export const meta = {
'ja-JP': '指定された種類のファイルが添付された投稿のみを取得します'
}
},
excludeNsfw: {
validator: $.bool.optional,
default: false,
desc: {
'ja-JP': 'true にすると、NSFW指定されたファイルを除外します(fileTypeが指定されている場合のみ有効)'
}
},
}
};
@ -233,6 +241,12 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
query['_files.contentType'] = {
$in: ps.fileType
};
if (ps.excludeNsfw) {
query['_files.metadata.isSensitive'] = {
$ne: true
};
}
}
//#endregion