This commit is contained in:
mattyatea 2023-10-08 00:25:33 +09:00
parent 3bc93e519e
commit 271d3483b2
5 changed files with 64 additions and 17 deletions

View File

@ -18,7 +18,7 @@
"build-assets": "node ./scripts/build-assets.mjs", "build-assets": "node ./scripts/build-assets.mjs",
"build": "pnpm build-pre && pnpm -r build && pnpm build-assets", "build": "pnpm build-pre && pnpm -r build && pnpm build-assets",
"build-storybook": "pnpm --filter frontend build-storybook", "build-storybook": "pnpm --filter frontend build-storybook",
"build-and-start": "pnpm build && pnpm start", "build-and-start": "pnpm i && pnpm build && pnpm start",
"start": "pnpm check:connect && cd packages/backend && node ./built/boot/entry.js", "start": "pnpm check:connect && cd packages/backend && node ./built/boot/entry.js",
"start:test": "cd packages/backend && cross-env NODE_ENV=test node ./built/boot/entry.js", "start:test": "cd packages/backend && cross-env NODE_ENV=test node ./built/boot/entry.js",
"init": "pnpm migrate", "init": "pnpm migrate",

View File

@ -13,9 +13,9 @@ import { DI } from '@/di-symbols.js';
import { CacheService } from '@/core/CacheService.js'; import { CacheService } from '@/core/CacheService.js';
import { IdService } from '@/core/IdService.js'; import { IdService } from '@/core/IdService.js';
import { isUserRelated } from '@/misc/is-user-related.js'; import { isUserRelated } from '@/misc/is-user-related.js';
import { QueryService } from '@/server/api/QueryService.js'; import { QueryService } from '@/core/QueryService.js';
import { ApiError } from '../../error.js'; import { ApiError } from '../../error.js';
import { GetterService } from '@/core/GetterService.js' import { GetterService } from '@/server/api/GetterService.js'
export const meta = { export const meta = {
tags: ['users', 'notes'], tags: ['users', 'notes'],
@ -118,15 +118,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
noteIds = noteIds.slice(0, ps.limit); noteIds = noteIds.slice(0, ps.limit);
if (noteIds.length < limit) { if (noteIds.length < limit) {
// Lookup user
const user = await this.getterService.getUser(ps.userId).catch(err => {
if (err.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
throw err;
});
//#region Construct query //#region Construct query
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate) const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere('note.userId = :userId', { userId: user.id }) .andWhere('note.userId = :userId', { userId: ps.userId })
.innerJoinAndSelect('note.user', 'user') .innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.reply', 'reply') .leftJoinAndSelect('note.reply', 'reply')
.leftJoinAndSelect('note.renote', 'renote') .leftJoinAndSelect('note.renote', 'renote')
@ -141,7 +136,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
this.queryService.generateVisibilityQuery(query, me); this.queryService.generateVisibilityQuery(query, me);
if (me) { if (me) {
this.queryService.generateMutedUserQuery(query, me, user); this.queryService.generateMutedUserQuery(query, me);
this.queryService.generateBlockedUserQuery(query, me); this.queryService.generateBlockedUserQuery(query, me);
} }
@ -165,7 +160,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (ps.includeMyRenotes === false) { if (ps.includeMyRenotes === false) {
query.andWhere(new Brackets(qb => { query.andWhere(new Brackets(qb => {
qb.orWhere('note.userId != :userId', { userId: user.id }); qb.orWhere('note.userId != :userId', { userId: ps.userId });
qb.orWhere('note.renoteId IS NULL'); qb.orWhere('note.renoteId IS NULL');
qb.orWhere('note.text IS NOT NULL'); qb.orWhere('note.text IS NOT NULL');
qb.orWhere('note.fileIds != \'{}\''); qb.orWhere('note.fileIds != \'{}\'');

View File

@ -65,7 +65,7 @@ const withReplies_store = computed(defaultStore.makeGetterSetter('withRenotes')
const withRenotes_store = computed(defaultStore.makeGetterSetter('withReplies')) const withRenotes_store = computed(defaultStore.makeGetterSetter('withReplies'))
const onlyFiles_store = computed(defaultStore.makeGetterSetter('onlyFiles')) const onlyFiles_store = computed(defaultStore.makeGetterSetter('onlyFiles'))
const withRenotes = $ref(defaultStore.state.onlyAndWithSave ? withRenotes_store : true); const withRenotes = $ref(defaultStore.state.onlyAndWithSave ? withRenotes_store : true);
const withReplies = $ref(defaultStore.state.onlyAndWithSave ? withReplies_store : false); const withReplies = $ref(defaultStore.state.onlyAndWithSave ? withReplies_store : true);
const onlyFiles = $ref(defaultStore.state.onlyAndWithSave ? onlyFiles_store : false); const onlyFiles = $ref(defaultStore.state.onlyAndWithSave ? onlyFiles_store : false);
const isShowMediaTimeline = $ref(defaultStore.state.showMediaTimeline) const isShowMediaTimeline = $ref(defaultStore.state.showMediaTimeline)
watch($$(src), () => queue = 0); watch($$(src), () => queue = 0);

View File

@ -362,7 +362,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
onlyAndWithSave:{ onlyAndWithSave:{
where: 'device', where: 'device',
default: true, default: false,
}, },
onlyFiles:{ onlyFiles:{
where: 'device', where: 'device',
@ -370,7 +370,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
withReplies:{ withReplies:{
where: 'device', where: 'device',
default: false, default: true,
}, },
withRenotes:{ withRenotes:{
where: 'device', where: 'device',

View File

@ -814,6 +814,9 @@ importers:
vue: vue:
specifier: 3.3.4 specifier: 3.3.4
version: 3.3.4 version: 3.3.4
vue-multiselect:
specifier: ^2.1.7
version: 2.1.7
vue-prism-editor: vue-prism-editor:
specifier: 2.0.0-alpha.2 specifier: 2.0.0-alpha.2
version: 2.0.0-alpha.2(vue@3.3.4) version: 2.0.0-alpha.2(vue@3.3.4)
@ -6906,7 +6909,7 @@ packages:
ts-dedent: 2.2.0 ts-dedent: 2.2.0
type-fest: 2.19.0 type-fest: 2.19.0
vue: 3.3.4 vue: 3.3.4
vue-component-type-helpers: 1.8.15 vue-component-type-helpers: 1.8.16
transitivePeerDependencies: transitivePeerDependencies:
- encoding - encoding
- supports-color - supports-color
@ -7972,6 +7975,10 @@ packages:
'@types/node': 20.8.2 '@types/node': 20.8.2
dev: true dev: true
/@types/web-bluetooth@0.0.18:
resolution: {integrity: sha512-v/ZHEj9xh82usl8LMR3GarzFY1IrbXJw5L4QfQhokjRV91q+SelFqxQWSep1ucXEZ22+dSTwLFkXeur25sPIbw==}
dev: false
/@types/web-push@3.6.1: /@types/web-push@3.6.1:
resolution: {integrity: sha512-Zu6Iju7c4IlE8I8eEeFLYRb7XFqvHFmWWAYr1cmug9EX3c6CDarxIXWN/GO0sxjbJLkHPwozUzp6cLdXsrq7Ew==} resolution: {integrity: sha512-Zu6Iju7c4IlE8I8eEeFLYRb7XFqvHFmWWAYr1cmug9EX3c6CDarxIXWN/GO0sxjbJLkHPwozUzp6cLdXsrq7Ew==}
dependencies: dependencies:
@ -8403,6 +8410,31 @@ packages:
- typescript - typescript
dev: true dev: true
/@vueuse/core@10.5.0(vue@3.3.4):
resolution: {integrity: sha512-z/tI2eSvxwLRjOhDm0h/SXAjNm8N5ld6/SC/JQs6o6kpJ6Ya50LnEL8g5hoYu005i28L0zqB5L5yAl8Jl26K3A==}
dependencies:
'@types/web-bluetooth': 0.0.18
'@vueuse/metadata': 10.5.0
'@vueuse/shared': 10.5.0(vue@3.3.4)
vue-demi: 0.14.6(vue@3.3.4)
transitivePeerDependencies:
- '@vue/composition-api'
- vue
dev: false
/@vueuse/metadata@10.5.0:
resolution: {integrity: sha512-fEbElR+MaIYyCkeM0SzWkdoMtOpIwO72x8WsZHRE7IggiOlILttqttM69AS13nrDxosnDBYdyy3C5mR1LCxHsw==}
dev: false
/@vueuse/shared@10.5.0(vue@3.3.4):
resolution: {integrity: sha512-18iyxbbHYLst9MqU1X1QNdMHIjks6wC7XTVf0KNOv5es/Ms6gjVFCAAWTVP2JStuGqydg3DT+ExpFORUEi9yhg==}
dependencies:
vue-demi: 0.14.6(vue@3.3.4)
transitivePeerDependencies:
- '@vue/composition-api'
- vue
dev: false
/@webgpu/types@0.1.30: /@webgpu/types@0.1.30:
resolution: {integrity: sha512-9AXJSmL3MzY8ZL//JjudA//q+2kBRGhLBFpkdGksWIuxrMy81nFrCzj2Am+mbh8WoU6rXmv7cY5E3rdlyru2Qg==} resolution: {integrity: sha512-9AXJSmL3MzY8ZL//JjudA//q+2kBRGhLBFpkdGksWIuxrMy81nFrCzj2Am+mbh8WoU6rXmv7cY5E3rdlyru2Qg==}
requiresBuild: true requiresBuild: true
@ -19173,8 +19205,8 @@ packages:
resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==} resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
/vue-component-type-helpers@1.8.15: /vue-component-type-helpers@1.8.16:
resolution: {integrity: sha512-RKiPRKW4BdwgmQ9vaNkHYKAThdTbgU4TOphVyyzqxRwsOJOoRIrb+vB49XLvs5CKPNrvxMXZMwPe5FyJCqFWyg==} resolution: {integrity: sha512-Pbm1/OyJ1m+8TnMApwHu9+WFqju756rdjdhd9TxldkbjmD5baVXVE3UnCqGa/qlEqUxqgi6zC7I5OKNUI8inGQ==}
dev: true dev: true
/vue-demi@0.13.11(vue@3.3.4): /vue-demi@0.13.11(vue@3.3.4):
@ -19192,6 +19224,21 @@ packages:
vue: 3.3.4 vue: 3.3.4
dev: false dev: false
/vue-demi@0.14.6(vue@3.3.4):
resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
peerDependencies:
'@vue/composition-api': ^1.0.0-rc.1
vue: ^3.0.0-0 || ^2.6.0
peerDependenciesMeta:
'@vue/composition-api':
optional: true
dependencies:
vue: 3.3.4
dev: false
/vue-docgen-api@4.64.1(vue@3.3.4): /vue-docgen-api@4.64.1(vue@3.3.4):
resolution: {integrity: sha512-jbOf7ByE3Zvtuk+429Jorl+eIeh2aB2Fx1GUo3xJd1aByJWE8KDlSEa6b11PB1ze8f0sRUBraRDinICCk0KY7g==} resolution: {integrity: sha512-jbOf7ByE3Zvtuk+429Jorl+eIeh2aB2Fx1GUo3xJd1aByJWE8KDlSEa6b11PB1ze8f0sRUBraRDinICCk0KY7g==}
dependencies: dependencies:
@ -19236,6 +19283,11 @@ packages:
vue: 3.3.4 vue: 3.3.4
dev: true dev: true
/vue-multiselect@2.1.7:
resolution: {integrity: sha512-KIegcN+Ntwg3cbkY/jhw2s/+XJUM0Lpi/LcKFYCS8PrZHcWBl2iKCVze7ZCnRj3w8H7/lUJ9v7rj9KQiNxApBw==}
engines: {node: '>= 4.0.0', npm: '>= 3.0.0'}
dev: false
/vue-prism-editor@2.0.0-alpha.2(vue@3.3.4): /vue-prism-editor@2.0.0-alpha.2(vue@3.3.4):
resolution: {integrity: sha512-Gu42ba9nosrE+gJpnAEuEkDMqG9zSUysIR8SdXUw8MQKDjBnnNR9lHC18uOr/ICz7yrA/5c7jHJr9lpElODC7w==} resolution: {integrity: sha512-Gu42ba9nosrE+gJpnAEuEkDMqG9zSUysIR8SdXUw8MQKDjBnnNR9lHC18uOr/ICz7yrA/5c7jHJr9lpElODC7w==}
engines: {node: '>=10'} engines: {node: '>=10'}