1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-01 00:08:24 +09:00

Hide NSFW in Photos (#3875)

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

View File

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

View File

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

View File

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

View File

@ -124,6 +124,14 @@ export const meta = {
'ja-JP': '指定された種類のファイルが添付された投稿のみを取得します' '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'] = { query['_files.contentType'] = {
$in: ps.fileType $in: ps.fileType
}; };
if (ps.excludeNsfw) {
query['_files.metadata.isSensitive'] = {
$ne: true
};
}
} }
//#endregion //#endregion