From c6993ad7e0bccc01dec2a07594f58c406cec2e9a Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 9 Aug 2022 01:52:32 -0700 Subject: [PATCH] fix: recommended timeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I doubt itll work, but... 🙏 hail mairy certified typeorm moment im stuff debug log not a fan of js/ts istg missing parenthesis postgres can kiss my ass didnt need `::string[]` i think hide caption button Remove debug log Clean up no longer beta! fix streaming --- CALCKEY.md | 2 +- package.json | 2 +- .../server/api/endpoints/notes/recommended-timeline.ts | 10 ++-------- .../server/api/stream/channels/recommended-timeline.ts | 2 +- packages/client/src/components/media-caption.vue | 2 +- packages/client/src/pages/admin/settings.vue | 1 - 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/CALCKEY.md b/CALCKEY.md index 9644a0fc6..dacaf77ee 100644 --- a/CALCKEY.md +++ b/CALCKEY.md @@ -20,7 +20,6 @@ ## Work in progress -- Recommended instances timeline - OCR image captioning - Admin custom CSS - Improve accesibility score @@ -35,6 +34,7 @@ - Yarn 3 - Fix Dockerfile @hanna - Saner defaults +- Recommended instances timeline - Star as default reaction - Recommended Instances timeline - Rosé Pine by default (+ non-themable elements made Rosé Pine) diff --git a/package.json b/package.json index 437d98564..fa1ae4545 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "12.118.1-calc.rc.4.13", + "version": "12.118.1-calc.rc.6", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts index 1cd47557a..ae2d58274 100644 --- a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts @@ -1,6 +1,6 @@ import { Brackets } from 'typeorm'; import { fetchMeta } from '@/misc/fetch-meta.js'; -import { Notes, Users } from '@/models/index.js'; +import { Notes } from '@/models/index.js'; import { activeUsersChart } from '@/services/chart/index.js'; import define from '../../define.js'; import { ApiError } from '../../error.js'; @@ -65,16 +65,10 @@ export default define(meta, paramDef, async (ps, user) => { } } - // .andWhere('(note.userHost IN (:instances)) OR (note.userHost IS NULL)', { instances: instances }) //#region Construct query const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate) - // Query where note.userHost is in recommended instances - .andWhere('(note.userHost IN (:instances)) OR (note.userHost IS NULL)', { instances: m.recommendedInstances }) - // .andWhere(new Brackets(qb => { - // qb.where('note.userHost IN :instances', { instances: m.recommendedInstances }) - // .orWhere('note.userHost IS NULL'); - // })) + .andWhere(`(note.userHost = ANY ('{"${m.recommendedInstances.join('","')}"}'))`) .andWhere('(note.visibility = \'public\')') .innerJoinAndSelect('note.user', 'user') .leftJoinAndSelect('user.avatar', 'avatar') diff --git a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts index 4d4b324f9..c0625aec8 100644 --- a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts @@ -30,7 +30,7 @@ export default class extends Channel { // フォローしているチャンネルの投稿 の場合だけ const meta = await fetchMeta(); if (!( - ((note.user.host == null || meta.recommendedInstances.includes(note.user.host)) && note.visibility === 'public') + ((note.user.host != null && meta.recommendedInstances.includes(note.user.host)) && note.visibility === 'public') )) return; // Ignore notes from instances the user has muted diff --git a/packages/client/src/components/media-caption.vue b/packages/client/src/components/media-caption.vue index 49ad51b59..c75dbed5b 100644 --- a/packages/client/src/components/media-caption.vue +++ b/packages/client/src/components/media-caption.vue @@ -12,7 +12,7 @@
{{ $ts.ok }} - {{ $ts.caption }} + {{ $ts.cancel }}
diff --git a/packages/client/src/pages/admin/settings.vue b/packages/client/src/pages/admin/settings.vue index ed8ae6ed8..101c4a6b4 100644 --- a/packages/client/src/pages/admin/settings.vue +++ b/packages/client/src/pages/admin/settings.vue @@ -56,7 +56,6 @@ {{ i18n.ts.enableRecommendedTimeline }} -