feat: Pin to home (#2880)

This commit is contained in:
Tom Moor
2021-12-30 16:54:02 -08:00
committed by GitHub
parent 5be2eb75f3
commit eb0c324da8
57 changed files with 1884 additions and 819 deletions

View File

@@ -26,7 +26,7 @@ async function replaceImageAttachments(text: string) {
export default async function present(
document: any,
options: Options | null | undefined
options: Options | null | undefined = {}
) {
options = {
isPublic: false,
@@ -58,7 +58,6 @@ export default async function present(
starred: document.starred ? !!document.starred.length : undefined,
revision: document.revisionCount,
fullWidth: document.fullWidth,
pinned: undefined,
collectionId: undefined,
parentDocumentId: undefined,
lastViewedAt: undefined,
@@ -69,8 +68,6 @@ export default async function present(
}
if (!options.isPublic) {
// @ts-expect-error ts-migrate(2322) FIXME: Type 'boolean' is not assignable to type 'undefine... Remove this comment to see the full error message
data.pinned = !!document.pinnedById;
data.collectionId = document.collectionId;
data.parentDocumentId = document.parentDocumentId;
// @ts-expect-error ts-migrate(2322) FIXME: Type 'UserPresentation | null | undefined' is not ... Remove this comment to see the full error message

View File

@@ -10,6 +10,7 @@ import presentGroupMembership from "./groupMembership";
import presentIntegration from "./integration";
import presentMembership from "./membership";
import presentNotificationSetting from "./notificationSetting";
import presentPin from "./pin";
import presentPolicies from "./policy";
import presentRevision from "./revision";
import presentSearchQuery from "./searchQuery";
@@ -37,6 +38,7 @@ export {
presentMembership,
presentNotificationSetting,
presentSlackAttachment,
presentPin,
presentPolicies,
presentGroupMembership,
presentCollectionGroupMembership,

10
server/presenters/pin.ts Normal file
View File

@@ -0,0 +1,10 @@
export default function present(pin: any) {
return {
id: pin.id,
documentId: pin.documentId,
collectionId: pin.collectionId,
index: pin.index,
createdAt: pin.createdAt,
updatedAt: pin.updatedAt,
};
}