aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/models/current_user_utils.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-08-19 15:55:36 -0400
committerbob <bcz@cs.brown.edu>2019-08-19 15:55:36 -0400
commit0e4729a8d634c67a3575761784b840a28694ba7a (patch)
tree7a5e686bb1e0ad311bc5572f052a145917f032e1 /src/server/authentication/models/current_user_utils.ts
parent697ee484fc9d5db6cf61397451869b563e97206e (diff)
fixed treeview dragging. got rid of extra stuff from presentationview
Diffstat (limited to 'src/server/authentication/models/current_user_utils.ts')
-rw-r--r--src/server/authentication/models/current_user_utils.ts23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index f36f5b73d..508655605 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -10,20 +10,17 @@ import { CollectionView } from "../../../client/views/collections/CollectionView
import { Doc } from "../../../new_fields/Doc";
import { List } from "../../../new_fields/List";
import { listSpec } from "../../../new_fields/Schema";
-import { Cast, FieldValue, StrCast } from "../../../new_fields/Types";
-import { RouteStore } from "../../RouteStore";
+import { Cast, StrCast } from "../../../new_fields/Types";
import { Utils } from "../../../Utils";
+import { RouteStore } from "../../RouteStore";
export class CurrentUserUtils {
- private static curr_email: string;
private static curr_id: string;
- @observable private static user_document: Doc;
//TODO tfs: these should be temporary...
private static mainDocId: string | undefined;
- public static get email() { return this.curr_email; }
public static get id() { return this.curr_id; }
- @computed public static get UserDocument() { return this.user_document; }
+ @computed public static get UserDocument() { return Doc.UserDoc(); }
public static get MainDocId() { return this.mainDocId; }
public static set MainDocId(id: string | undefined) { this.mainDocId = id; }
@@ -32,7 +29,7 @@ export class CurrentUserUtils {
doc.viewType = CollectionViewType.Tree;
doc.dropAction = "alias";
doc.layout = CollectionView.LayoutString();
- doc.title = this.email;
+ doc.title = Doc.CurrentUserEmail
this.updateUserDocument(doc);
doc.data = new List<Doc>();
doc.gridGap = 5;
@@ -58,6 +55,12 @@ export class CurrentUserUtils {
recentlyClosed.boxShadow = "0 0";
doc.recentlyClosed = recentlyClosed;
}
+ if (doc.curPresentation === undefined) {
+ const curPresentation = Docs.Create.PresDocument(new List<Doc>(), { title: "Presentation" });
+ curPresentation.excludeFromLibrary = true;
+ curPresentation.boxShadow = "0 0";
+ doc.curPresentation = curPresentation;
+ }
if (doc.sidebar === undefined) {
const sidebar = Docs.Create.StackingDocument([doc.workspaces as Doc, doc, doc.recentlyClosed as Doc], { title: "Sidebar" });
sidebar.excludeFromLibrary = true;
@@ -85,15 +88,15 @@ export class CurrentUserUtils {
public static async loadUserDocument({ id, email }: { id: string, email: string }) {
this.curr_id = id;
- this.curr_email = email;
+ Doc.CurrentUserEmail = email;
await rp.get(Utils.prepend(RouteStore.getUserDocumentId)).then(id => {
if (id) {
return DocServer.GetRefField(id).then(async field => {
if (field instanceof Doc) {
await this.updateUserDocument(field);
- runInAction(() => this.user_document = field);
+ runInAction(() => Doc.SetUserDoc(field));
} else {
- runInAction(() => this.user_document = this.createUserDocument(id));
+ runInAction(() => Doc.SetUserDoc(this.createUserDocument(id)));
}
});
} else {