aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-05-06 17:26:45 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-05-06 17:26:45 -0400
commitd2ec862ad60f0501a5184f9d424cc5db07b998b0 (patch)
treeb7773f46f0dbb08d1b2fd879e3e9164ac75c8167 /src/client/documents/Documents.ts
parent911a8b6af776e58e7bf9d2653c3b604c583a458d (diff)
Added author and creation date
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 8706359e4..37d263e75 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -33,6 +33,7 @@ import { listSpec } from "../../new_fields/Schema";
import { DocServer } from "../DocServer";
import { StrokeData, InkField } from "../../new_fields/InkField";
import { dropActionType } from "../util/DragManager";
+import { DateField } from "../../new_fields/DateField";
export interface DocumentOptions {
x?: number;
@@ -168,6 +169,13 @@ export namespace Docs {
function CreateInstance(proto: Doc, data: Field, options: DocumentOptions) {
const { omit: protoProps, extract: delegateProps } = OmitKeys(options, delegateKeys);
+ if (!("author" in protoProps)) {
+ protoProps.author = CurrentUserUtils.email;
+ }
+ if (!("creationDate" in protoProps)) {
+ protoProps.creationDate = new DateField;
+ }
+
return SetDelegateOptions(SetInstanceOptions(proto, protoProps, data), delegateProps);
}