diff --git a/src/backend/reposts.ts b/src/backend/reposts.ts index a3e82016c..d61149f04 100644 --- a/src/backend/reposts.ts +++ b/src/backend/reposts.ts @@ -45,13 +45,15 @@ export interface IGetRepostsOptions { offset?: number limit?: number following?: string + type?: `simple` | `quote` } export async function getReposts( - filter: { authorID: string; postCID?: string }, + filter: { authorID?: string; postCID?: string }, options: IGetRepostsOptions, ): Promise { - const { sort, offset = 0, limit = 10, following } = options + const { sort, offset = 0, limit = 10, following, type } = options + if (sort === `FOLLOWING` && !following) { throw new Error(`Following not specified`) } @@ -64,6 +66,7 @@ export async function getReposts( following, offset, limit, + ...(type ? { type } : {}), }, }) diff --git a/src/backend/utilities/caching.ts b/src/backend/utilities/caching.ts index 1f5679b69..95fd08c6e 100644 --- a/src/backend/utilities/caching.ts +++ b/src/backend/utilities/caching.ts @@ -24,6 +24,9 @@ export default function cache(fetchFunction: (key: string) => Promise) { if (!update) { const cached = _cache.get(key) if (cached !== undefined) { + if (typeof cached === `object`) { + return { ...cached } + } return cached } } diff --git a/src/components/ProfilePreview.vue b/src/components/ProfilePreview.vue index 73f939108..72b414321 100644 --- a/src/components/ProfilePreview.vue +++ b/src/components/ProfilePreview.vue @@ -1,5 +1,5 @@