From dadd7c13064f08fa2220575c0988b4dcadb6abdb Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 27 Apr 2023 23:35:18 -0400
Subject: removing unused code - viewspecscript and x,y in slowloaddocumnts

---
 src/client/views/collections/CollectionSubView.tsx | 51 ++++++----------------
 1 file changed, 14 insertions(+), 37 deletions(-)

(limited to 'src/client/views/collections/CollectionSubView.tsx')

diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 5581ac8fe..5b9453666 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -110,9 +110,7 @@ export function CollectionSubView<X>(moreProps?: X) {
                 rawdocs = rootDoc && !this.props.isAnnotationOverlay ? [Doc.GetProto(rootDoc)] : [];
             }
 
-            const docs = rawdocs.filter(d => !(d instanceof Promise) && GetEffectiveAcl(Doc.GetProto(d)) !== AclPrivate && (this.props.ignoreUnrendered || !d.unrendered)).map(d => d as Doc);
-            const viewSpecScript = Cast(this.props.Document.viewSpecScript, ScriptField);
-            const childDocs = viewSpecScript ? docs.filter(d => viewSpecScript.script.run({ doc: d }, console.log).result) : docs;
+            const childDocs = rawdocs.filter(d => !(d instanceof Promise) && GetEffectiveAcl(Doc.GetProto(d)) !== AclPrivate && (this.props.ignoreUnrendered || !d.unrendered)).map(d => d as Doc);
 
             const childDocFilters = this.childDocFilters();
             const docRangeFilters = this.childDocRangeFilters();
@@ -126,24 +124,23 @@ export function CollectionSubView<X>(moreProps?: X) {
                 // dragging facets
                 const dragged = this.props.docFilters?.().some(f => f.includes(Utils.noDragsDocFilter));
                 if (dragged && DragManager.docsBeingDragged.includes(d)) return false;
-                let notFiltered = d.z || Doc.IsSystem(d) || DocUtils.FilterDocs([d], this.unrecursiveDocFilters(), docRangeFilters, viewSpecScript, this.props.Document).length > 0;
+                let notFiltered = d.z || Doc.IsSystem(d) || DocUtils.FilterDocs([d], this.unrecursiveDocFilters(), docRangeFilters, this.props.Document).length > 0;
                 if (notFiltered) {
-                    notFiltered = (!searchDocs.length || searchDocs.includes(d)) && DocUtils.FilterDocs([d], childDocFilters, docRangeFilters, viewSpecScript, this.props.Document).length > 0;
+                    notFiltered = (!searchDocs.length || searchDocs.includes(d)) && DocUtils.FilterDocs([d], childDocFilters, docRangeFilters, this.props.Document).length > 0;
                     const fieldKey = Doc.LayoutFieldKey(d);
-                    const annos = !Field.toString(Doc.LayoutField(d) as Field).includes('CollectionView');
+                    const annos = !Field.toString(Doc.LayoutField(d) as Field).includes(CollectionView.name);
                     const data = d[annos ? fieldKey + '-annotations' : fieldKey];
                     if (data !== undefined) {
                         let subDocs = DocListCast(data);
                         if (subDocs.length > 0) {
                             let newarray: Doc[] = [];
-                            notFiltered = notFiltered || (!searchDocs.length && DocUtils.FilterDocs(subDocs, childDocFilters, docRangeFilters, viewSpecScript, d).length);
+                            notFiltered = notFiltered || (!searchDocs.length && DocUtils.FilterDocs(subDocs, childDocFilters, docRangeFilters, d).length);
                             while (subDocs.length > 0 && !notFiltered) {
                                 newarray = [];
                                 subDocs.forEach(t => {
                                     const fieldKey = Doc.LayoutFieldKey(t);
-                                    const annos = !Field.toString(Doc.LayoutField(t) as Field).includes('CollectionView');
-                                    notFiltered =
-                                        notFiltered || ((!searchDocs.length || searchDocs.includes(t)) && ((!childDocFilters.length && !docRangeFilters.length) || DocUtils.FilterDocs([t], childDocFilters, docRangeFilters, viewSpecScript, d).length));
+                                    const annos = !Field.toString(Doc.LayoutField(t) as Field).includes(CollectionView.name);
+                                    notFiltered = notFiltered || ((!searchDocs.length || searchDocs.includes(t)) && ((!childDocFilters.length && !docRangeFilters.length) || DocUtils.FilterDocs([t], childDocFilters, docRangeFilters, d).length));
                                     DocListCast(t[annos ? fieldKey + '-annotations' : fieldKey]).forEach(newdoc => newarray.push(newdoc));
                                 });
                                 subDocs = newarray;
@@ -348,7 +345,7 @@ export function CollectionSubView<X>(moreProps?: X) {
                 if ((uriList || text).includes('www.youtube.com/watch') || text.includes('www.youtube.com/embed')) {
                     const batch = UndoManager.StartBatch('youtube upload');
                     const generatedDocuments: Doc[] = [];
-                    this.slowLoadDocuments((uriList || text).split('v=')[1].split('&')[0], options, generatedDocuments, text, completed, e.clientX, e.clientY, addDocument).then(batch.end);
+                    this.slowLoadDocuments((uriList || text).split('v=')[1].split('&')[0], options, generatedDocuments, text, completed, addDocument).then(batch.end);
 
                     return;
                 }
@@ -370,18 +367,8 @@ export function CollectionSubView<X>(moreProps?: X) {
                 // }
             }
             if (uriList) {
-                // const existingWebDoc = await Hypothesis.findWebDoc(uriList);
-                // if (existingWebDoc) {
-                //     const alias = Doc.MakeAlias(existingWebDoc);
-                //     alias.x = options.x;
-                //     alias.y = options.y;
-                //     alias._nativeWidth = 850;
-                //     alias._height = 512;
-                //     alias._width = 400;
-                //     addDocument(alias);
-                // } else
-                {
-                    const newDoc = Docs.Create.WebDocument(uriList.split('#annotations:')[0], {
+                addDocument(
+                    Docs.Create.WebDocument(uriList.split('#annotations:')[0], {
                         // clean hypothes.is URLs that reference a specific annotation (eg. https://en.wikipedia.org/wiki/Cartoon#annotations:t7qAeNbCEeqfG5972KR2Ig)
                         ...options,
                         title: uriList.split('#annotations:')[0],
@@ -389,9 +376,8 @@ export function CollectionSubView<X>(moreProps?: X) {
                         _height: 512,
                         _nativeWidth: 850,
                         useCors: true,
-                    });
-                    addDocument(newDoc);
-                }
+                    })
+                );
                 return;
             }
 
@@ -437,19 +423,10 @@ export function CollectionSubView<X>(moreProps?: X) {
                         });
                 }
             }
-            this.slowLoadDocuments(files, options, generatedDocuments, text, completed, e.clientX, e.clientY, addDocument).then(batch.end);
+            this.slowLoadDocuments(files, options, generatedDocuments, text, completed, addDocument).then(batch.end);
         }
 
-        slowLoadDocuments = async (
-            files: File[] | string,
-            options: DocumentOptions,
-            generatedDocuments: Doc[],
-            text: string,
-            completed: ((doc: Doc[]) => void) | undefined,
-            clientX: number,
-            clientY: number,
-            addDocument: (doc: Doc | Doc[]) => boolean
-        ) => {
+        slowLoadDocuments = async (files: File[] | string, options: DocumentOptions, generatedDocuments: Doc[], text: string, completed: ((doc: Doc[]) => void) | undefined, addDocument: (doc: Doc | Doc[]) => boolean) => {
             // create placeholder docs
             // inside placeholder docs have some func that
 
-- 
cgit v1.2.3-70-g09d2

