Files
outline/server/presenters/share.ts
codegen-sh[bot]andTom Moor 7a5480f12f Add option to show modified timestamp on shared docs (#9347)
* Add showLastModified option to Share models

- Add showLastModified column to shares table with migration
- Add showLastModified field to client and server Share models
- Add 'Show last modified' toggle in share popover (PublicAccess component)
- Update shares.update API route to handle showLastModified field
- Include share data in documents.info API response for shared documents
- Modify DocumentMeta visibility logic to show timestamp when showLastModified is enabled
- Add proper type definitions across component hierarchy
- Follow existing patterns used by allowIndexing option

* Applied automatic fixes

* refactor

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-31 11:29:55 -04:00

30 lines
810 B
TypeScript

import { Share } from "@server/models";
import { presentUser } from ".";
export default function presentShare(share: Share, isAdmin = false) {
const data = {
id: share.id,
documentId: share.documentId,
documentTitle: share.document?.title,
documentUrl: share.document?.url,
published: share.published,
url: share.canonicalUrl,
urlId: share.urlId,
createdBy: presentUser(share.user),
includeChildDocuments: share.includeChildDocuments,
allowIndexing: share.allowIndexing,
showLastUpdated: share.showLastUpdated,
lastAccessedAt: share.lastAccessedAt || undefined,
views: share.views || 0,
domain: share.domain,
createdAt: share.createdAt,
updatedAt: share.updatedAt,
};
if (!isAdmin) {
delete data.lastAccessedAt;
}
return data;
}