From f28d4f6af00fb94e1862589e806e520d193c5d1d Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 6 Aug 2020 10:51:43 +0300 Subject: [PATCH] Fix isAdmin and isReadOnly for collections. --- src/Calendars/Main.tsx | 5 +---- src/Collections/Collection.tsx | 4 +++- src/Contacts/Main.tsx | 5 +---- src/Tasks/Main.tsx | 5 +---- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/Calendars/Main.tsx b/src/Calendars/Main.tsx index 320da45..19b9b55 100644 --- a/src/Calendars/Main.tsx +++ b/src/Calendars/Main.tsx @@ -168,11 +168,8 @@ export default function CalendarsMain() { return (); } - /* FIXME: const collection = collections!.find((x) => x.uid === colUid)!; - const readOnly = collection.accessLevel; - */ - const readOnly = false; + const readOnly = collection.accessLevel === Etebase.CollectionAccessLevel.ReadOnly; return ( diff --git a/src/Collections/Collection.tsx b/src/Collections/Collection.tsx index d1d6513..2b9cdb3 100644 --- a/src/Collections/Collection.tsx +++ b/src/Collections/Collection.tsx @@ -7,6 +7,8 @@ import IconEdit from "@material-ui/icons/Edit"; import IconMembers from "@material-ui/icons/People"; import IconImport from "@material-ui/icons/ImportExport"; +import * as Etebase from "etebase"; + import AppBarOverride from "../widgets/AppBarOverride"; import Container from "../widgets/Container"; @@ -42,7 +44,7 @@ class Collection extends React.Component { public render() { const { collection, metadata } = this.props.collection; - const isAdmin = true; // FIXME + const isAdmin = collection.accessLevel === Etebase.CollectionAccessLevel.Admin; return ( diff --git a/src/Contacts/Main.tsx b/src/Contacts/Main.tsx index 9addfa9..cd98871 100644 --- a/src/Contacts/Main.tsx +++ b/src/Contacts/Main.tsx @@ -160,11 +160,8 @@ export default function ContactsMain() { return (); } - /* FIXME: const collection = collections!.find((x) => x.uid === colUid)!; - const readOnly = collection.accessLevel; - */ - const readOnly = false; + const readOnly = collection.accessLevel === Etebase.CollectionAccessLevel.ReadOnly; return ( diff --git a/src/Tasks/Main.tsx b/src/Tasks/Main.tsx index 5eee8c2..6f94292 100644 --- a/src/Tasks/Main.tsx +++ b/src/Tasks/Main.tsx @@ -162,11 +162,8 @@ export default function TasksMain() { return (); } - /* FIXME: const collection = collections!.find((x) => x.uid === colUid)!; - const readOnly = collection.accessLevel; - */ - const readOnly = false; + const readOnly = collection.accessLevel === Etebase.CollectionAccessLevel.ReadOnly; return (