From 622a6cf0cd70dfba8ac6e452446e4b3b0956234f Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 11 Dec 2022 14:31:30 -0800 Subject: [PATCH 1/5] fix liked pages --- package.json | 2 +- packages/client/src/pages/pages.vue | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 39814bfe84..41199a2206 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.119.0-calc.19-b14", + "version": "12.119.0-calc.19-b15", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/pages/pages.vue b/packages/client/src/pages/pages.vue index 8d4cb3f020..a5bd4c4c8e 100644 --- a/packages/client/src/pages/pages.vue +++ b/packages/client/src/pages/pages.vue @@ -28,7 +28,7 @@
- +
@@ -64,11 +64,11 @@ const featuredPagesPagination = { }; const myPagesPagination = { endpoint: 'i/pages' as const, - limit: 5, + limit: 10, }; const likedPagesPagination = { endpoint: 'i/page-likes' as const, - limit: 5, + limit: 10, }; function create() { From a11fd6971dec8afbac37eca24694f03e2547eca7 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 11 Dec 2022 14:50:16 -0800 Subject: [PATCH 2/5] fix liked pages endpoint --- package.json | 2 +- packages/backend/src/models/repositories/page-like.ts | 8 ++++---- packages/backend/src/models/repositories/page.ts | 6 +++--- packages/backend/src/server/api/endpoints/i/page-likes.ts | 6 +++--- packages/backend/src/server/api/endpoints/i/pages.ts | 4 ++-- packages/client/src/pages/pages.vue | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 41199a2206..5299cd9410 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.119.0-calc.19-b15", + "version": "12.119.0-calc.19-b16", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/backend/src/models/repositories/page-like.ts b/packages/backend/src/models/repositories/page-like.ts index 87d6accc34..3f259f9819 100644 --- a/packages/backend/src/models/repositories/page-like.ts +++ b/packages/backend/src/models/repositories/page-like.ts @@ -1,12 +1,12 @@ import { db } from '@/db/postgre.js'; import { PageLike } from '@/models/entities/page-like.js'; +import type { User } from '@/models/entities/user.js'; import { Pages } from '../index.js'; -import { User } from '@/models/entities/user.js'; export const PageLikeRepository = db.getRepository(PageLike).extend({ async pack( src: PageLike['id'] | PageLike, - me?: { id: User['id'] } | null | undefined + me?: { id: User['id'] } | null | undefined, ) { const like = typeof src === 'object' ? src : await this.findOneByOrFail({ id: src }); @@ -17,8 +17,8 @@ export const PageLikeRepository = db.getRepository(PageLike).extend({ }, packMany( - likes: any[], - me: { id: User['id'] } + likes: PageLike[], + me: { id: User['id'] }, ) { return Promise.all(likes.map(x => this.pack(x, me))); }, diff --git a/packages/backend/src/models/repositories/page.ts b/packages/backend/src/models/repositories/page.ts index 65b54f8b87..1a8bc50e2e 100644 --- a/packages/backend/src/models/repositories/page.ts +++ b/packages/backend/src/models/repositories/page.ts @@ -1,9 +1,9 @@ import { db } from '@/db/postgre.js'; import { Page } from '@/models/entities/page.js'; -import { Packed } from '@/misc/schema.js'; +import type { Packed } from '@/misc/schema.js'; import { awaitAll } from '@/prelude/await-all.js'; -import { DriveFile } from '@/models/entities/drive-file.js'; -import { User } from '@/models/entities/user.js'; +import type { DriveFile } from '@/models/entities/drive-file.js'; +import type { User } from '@/models/entities/user.js'; import { Users, DriveFiles, PageLikes } from '../index.js'; export const PageRepository = db.getRepository(Page).extend({ diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 71e326e2f0..9873872375 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -1,5 +1,5 @@ -import define from '../../define.js'; import { PageLikes } from '@/models/index.js'; +import define from '../../define.js'; import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { @@ -26,7 +26,7 @@ export const meta = { ref: 'Page', }, }, - } + }, }, } as const; @@ -43,7 +43,7 @@ export const paramDef = { // eslint-disable-next-line import/no-default-export export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(PageLikes.createQueryBuilder('like'), ps.sinceId, ps.untilId) - .andWhere(`like.userId = :meId`, { meId: user.id }) + .andWhere('like.userId = :meId', { meId: user.id }) .leftJoinAndSelect('like.page', 'page'); const likes = await query diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index f28aed3fd4..7e1820d458 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -1,5 +1,5 @@ -import define from '../../define.js'; import { Pages } from '@/models/index.js'; +import define from '../../define.js'; import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { @@ -33,7 +33,7 @@ export const paramDef = { // eslint-disable-next-line import/no-default-export export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId) - .andWhere(`page.userId = :meId`, { meId: user.id }); + .andWhere('page.userId = :meId', { meId: user.id }); const pages = await query .take(ps.limit) diff --git a/packages/client/src/pages/pages.vue b/packages/client/src/pages/pages.vue index a5bd4c4c8e..66ba58df44 100644 --- a/packages/client/src/pages/pages.vue +++ b/packages/client/src/pages/pages.vue @@ -60,7 +60,7 @@ watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); const featuredPagesPagination = { endpoint: 'pages/featured' as const, - noPaging: true, + limit: 10, }; const myPagesPagination = { endpoint: 'i/pages' as const, From 21cd1162e3f3918b5ceb31a455ff66ef08c361d7 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 11 Dec 2022 15:09:04 -0800 Subject: [PATCH 3/5] remove like confirmation --- package.json | 2 +- .../client/src/components/MkPagePreview.vue | 3 +- packages/client/src/pages/gallery/post.vue | 7 +-- packages/client/src/pages/page.vue | 7 +-- packages/client/src/pages/pages.vue | 47 ++++++++++--------- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 5299cd9410..e9ef4a1640 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.119.0-calc.19-b16", + "version": "12.119.0-calc.19-b17", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/components/MkPagePreview.vue b/packages/client/src/components/MkPagePreview.vue index 009582e540..ef79b08c23 100644 --- a/packages/client/src/components/MkPagePreview.vue +++ b/packages/client/src/components/MkPagePreview.vue @@ -7,7 +7,7 @@

{{ page.summary.length > 85 ? page.summary.slice(0, 85) + '…' : page.summary }}

- +

{{ userName(page.user) }}

@@ -17,7 +17,6 @@