From 097359bf7cad9b64e7be9263e0061625268f18ec Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 9 Feb 2021 19:04:03 -0800 Subject: [PATCH] feat: Added ability to disable sharing at collection (#1875) * feat: Added ability to disable sharing at collection * fix: Disable all previous share links when disabling collection share Language * fix: Disable document sharing for read-only collection members * wip * test * fix: Clear policies after updating sharing settings * chore: Less ambiguous language * feat: Allow setting sharing choice on collection creation --- app/components/Switch.js | 19 ++++++-- app/menus/CollectionMenu.js | 4 +- app/menus/DocumentMenu.js | 10 ++-- app/models/Collection.js | 2 + app/scenes/Collection.js | 2 +- app/scenes/CollectionEdit.js | 34 ++++++++++++- app/scenes/CollectionNew.js | 48 ++++++++++++++----- app/scenes/Document/components/Header.js | 4 +- app/stores/CollectionsStore.js | 21 +++++++- server/api/collections.js | 7 ++- server/api/collections.test.js | 12 +++++ server/api/documents.js | 5 ++ server/api/documents.test.js | 17 +++++++ server/api/shares.test.js | 11 ++++- ...210208062816-disable-collection-sharing.js | 12 +++++ server/models/Collection.js | 5 ++ server/policies/collection.js | 23 +++++++++ server/policies/document.js | 16 +++++-- server/presenters/collection.js | 1 + shared/i18n/locales/en_US/translation.json | 7 ++- 20 files changed, 227 insertions(+), 33 deletions(-) create mode 100644 server/migrations/20210208062816-disable-collection-sharing.js diff --git a/app/components/Switch.js b/app/components/Switch.js index aaa08f18..172c54e9 100644 --- a/app/components/Switch.js +++ b/app/components/Switch.js @@ -13,17 +13,23 @@ type Props = {| id?: string, |}; -function Switch({ width = 38, height = 20, label, ...props }: Props) { +function Switch({ width = 38, height = 20, label, disabled, ...props }: Props) { const component = ( - + ); if (label) { return ( -