Files
outline/app/models/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

81 lines
1.5 KiB
TypeScript

import { computed, observable } from "mobx";
import Collection from "./Collection";
import Document from "./Document";
import User from "./User";
import Model from "./base/Model";
import Field from "./decorators/Field";
import Relation from "./decorators/Relation";
import { Searchable } from "./interfaces/Searchable";
class Share extends Model implements Searchable {
static modelName = "Share";
@Field
@observable
published: boolean;
@Field
@observable
includeChildDocuments: boolean;
/** The document ID that is shared. */
@Field
@observable
documentId: string;
/** The document that is shared. */
@Relation(() => Document, { onDelete: "cascade" })
document: Document;
/** The collection ID that is shared. */
@Field
@observable
collectionId: string;
/** The collection that is shared. */
@Relation(() => Collection, { onDelete: "cascade" })
collection: Collection;
@Field
@observable
urlId: string;
@Field
@observable
domain: string;
@observable
documentTitle: string;
@observable
documentUrl: string;
@observable
lastAccessedAt: string | null | undefined;
@observable
url: string;
@Field
@observable
allowIndexing: boolean;
@Field
@observable
showLastUpdated: boolean;
@observable
views: number;
/** The user that shared the document. */
@Relation(() => User, { onDelete: "null" })
createdBy: User;
@computed
get searchContent(): string[] {
return [this.document?.title ?? this.documentTitle];
}
}
export default Share;