diff --git a/app/components/Sidebar/components/SidebarContext.ts b/app/components/Sidebar/components/SidebarContext.ts index 8bcbc874e8..379d746d68 100644 --- a/app/components/Sidebar/components/SidebarContext.ts +++ b/app/components/Sidebar/components/SidebarContext.ts @@ -40,18 +40,18 @@ export const determineSidebarContext = ({ : starredSidebarContext(document.collectionId!); } - const membershipType = document.membershipType; - - if (membershipType === "document") { + if (document.collection) { + return "collections"; + } else if ( + user.documentMemberships.find((m) => m.documentId === document.id) + ) { return "shared"; - } else if (membershipType === "group") { + } else { const group = user.groupsWithDocumentMemberships.find( (g) => !!g.documentMemberships.find((m) => m.documentId === document.id) ); return groupSidebarContext(group?.id ?? ""); } - - return "collections"; }; export default SidebarContext; diff --git a/app/models/Document.ts b/app/models/Document.ts index 7e1418ae3a..6c0a9736a7 100644 --- a/app/models/Document.ts +++ b/app/models/Document.ts @@ -426,20 +426,6 @@ export default class Document extends ArchivableModel { return this.title || i18n.t("Untitled"); } - @computed - get membershipType(): "collection" | "document" | "group" { - if (this.collection) { - return "collection"; - } - - const hasDocumentMembership = - this.store.rootStore.auth.user?.documentMemberships.find( - (m) => m.documentId === this.id - ) ?? false; - - return hasDocumentMembership ? "document" : "group"; - } - @action updateTasks(total: number, completed: number) { if (total !== this.tasks.total || completed !== this.tasks.completed) {