From d4f3dd01976739be98d25d77708856230eb35d3e Mon Sep 17 00:00:00 2001 From: bobzel Date: Sat, 19 Sep 2020 17:59:00 -0400 Subject: changed Add-Only so that if you have Admin rights to a document you can remove it from a read-only or add-only collection --- src/client/views/collections/CollectionView.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/client/views/collections') diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx index 312bc045f..c9496d374 100644 --- a/src/client/views/collections/CollectionView.tsx +++ b/src/client/views/collections/CollectionView.tsx @@ -185,7 +185,8 @@ export class CollectionView extends Touchable { const effectiveAcl = GetEffectiveAcl(this.props.Document[DataSym]); - if (effectiveAcl === AclEdit || effectiveAcl === AclAdmin) { + const docAcl = GetEffectiveAcl(doc); + if (effectiveAcl === AclEdit || effectiveAcl === AclAdmin || docAcl === AclAdmin) { const docs = doc instanceof Doc ? [doc] : doc as Doc[]; const targetDataDoc = this.props.Document[DataSym]; const value = DocListCast(targetDataDoc[this.props.fieldKey]); @@ -193,8 +194,12 @@ export class CollectionView extends Touchable { - Doc.RemoveDocFromList(targetDataDoc, this.props.fieldKey, doc); - recent && Doc.AddDocToList(recent, "data", doc, undefined, true, true); + const ind = (targetDataDoc[this.props.fieldKey] as List).indexOf(doc); + (targetDataDoc[this.props.fieldKey] as List).splice(ind, 0); + if (ind !== -1) { + Doc.RemoveDocFromList(targetDataDoc, this.props.fieldKey, doc); + recent && Doc.AddDocToList(recent, "data", doc, undefined, true, true); + } }); return true; } -- cgit v1.2.3-70-g09d2