mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
* Address PR feedback: Move commenting logic to Collection model - Update openDocumentComments action to use collection.canCreateComment - Update AuthenticatedLayout to check collection-level commenting setting - Update DocumentMeta to use collection commenting preference - Add commenting field to CollectionForm with proper UI - Maintain backward compatibility with team-level preferences * Applied automatic fixes * Disable comment creation UI when collection commenting is disabled - Update Editor component to use collection-level commenting setting - Pass onCreateCommentMark as undefined when commenting is disabled - This removes the shortcut and toolbar icon for comment creation - Maintains backward compatibility with team-level preferences * Fix TypeScript error in Editor component - Fix props destructuring to avoid variable shadowing - Ensure all required props are properly destructured - Maintain correct property order from original implementation * Fix TypeScript error: add missing activeCollectionId parameter - Add activeCollectionId to import document action perform function - This parameter was being used but not declared in the function signature - Fixes TS2304 error: Cannot find name 'activeCollectionId' * fix form * docs --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import Collection from "@server/models/Collection";
|
|
import { DocumentHelper } from "@server/models/helpers/DocumentHelper";
|
|
import { APIContext } from "@server/types";
|
|
import presentUser from "./user";
|
|
|
|
export default async function presentCollection(
|
|
ctx: APIContext | undefined,
|
|
collection: Collection
|
|
) {
|
|
const asData = !ctx || Number(ctx?.headers["x-api-version"] ?? 0) >= 3;
|
|
|
|
return {
|
|
id: collection.id,
|
|
url: collection.url,
|
|
urlId: collection.urlId,
|
|
name: collection.name,
|
|
data: asData ? await DocumentHelper.toJSON(collection) : undefined,
|
|
description: asData ? undefined : collection.description,
|
|
sort: collection.sort,
|
|
icon: collection.icon,
|
|
index: collection.index,
|
|
color: collection.color,
|
|
permission: collection.permission,
|
|
commenting: collection.commenting,
|
|
sharing: collection.sharing,
|
|
createdAt: collection.createdAt,
|
|
updatedAt: collection.updatedAt,
|
|
deletedAt: collection.deletedAt,
|
|
archivedAt: collection.archivedAt,
|
|
archivedBy: collection.archivedBy && presentUser(collection.archivedBy),
|
|
};
|
|
}
|