aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocComponent.tsx
diff options
context:
space:
mode:
authorAndy Rickert <andrew_rickert@brown.edu>2020-08-03 16:27:09 -0400
committerAndy Rickert <andrew_rickert@brown.edu>2020-08-03 16:27:09 -0400
commitf21febd2fff86c9f4a537cd81adb6de98eaec929 (patch)
tree2685d95e3a14ce5ee2db7fb37e9c3abef9d1017c /src/client/views/DocComponent.tsx
parent76b8ce516103a469d36e876ddf3dd5b53f09c734 (diff)
parentfb8150f01232a3f8e9333f9ed7012b6982b00c24 (diff)
merge with new ui
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r--src/client/views/DocComponent.tsx33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 177c1b5ee..451bb8065 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -7,7 +7,7 @@ import { InteractionUtils } from '../util/InteractionUtils';
import { List } from '../../fields/List';
import { DateField } from '../../fields/DateField';
import { ScriptField } from '../../fields/ScriptField';
-import { GetEffectiveAcl, getPlaygroundMode, SharingPermissions } from '../../fields/util';
+import { GetEffectiveAcl, SharingPermissions } from '../../fields/util';
/// DocComponent returns a generic React base class used by views that don't have 'fieldKey' props (e.g.,CollectionFreeFormDocumentView, DocumentView)
@@ -150,16 +150,29 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T
const effectiveAcl = GetEffectiveAcl(this.dataDoc);
if (added.length) {
- if (effectiveAcl === AclPrivate || (effectiveAcl === AclReadonly && !getPlaygroundMode())) {
+ if (effectiveAcl === AclPrivate || effectiveAcl === AclReadonly) {
return false;
- } else if (this.dataDoc[AclSym] === AclAddonly) {
- added.map(doc => Doc.AddDocToList(targetDataDoc, this.annotationKey, doc));
- } else {
- added.map(doc => doc.context = this.props.Document);
- targetDataDoc[this.annotationKey] = new List<Doc>([...docList, ...added]);
- targetDataDoc[this.annotationKey + "-lastModified"] = new DateField(new Date(Date.now()));
- targetDataDoc["lastModified"] = new DateField(new Date(Date.now()));
-
+ }
+ else {
+ // if (this.props.Document[AclSym]) {
+ // added.forEach(d => {
+ // const dataDoc = d[DataSym];
+ // dataDoc[AclSym] = d[AclSym] = this.props.Document[AclSym];
+ // for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
+ // dataDoc[key] = d[key] = this.AclMap.get(value);
+ // }
+ // });
+ // }
+ if (effectiveAcl === AclAddonly) {
+ added.map(doc => Doc.AddDocToList(targetDataDoc, this.annotationKey, doc));
+ }
+ else {
+ added.map(doc => doc.context = this.props.Document);
+ (targetDataDoc[this.annotationKey] as List<Doc>).push(...added);
+ targetDataDoc[this.annotationKey + "-lastModified"] = new DateField(new Date(Date.now()));
+ targetDataDoc["lastModified"] = new DateField(new Date(Date.now()));
+
+ }
}
}
return true;