@@ -11,6 +11,7 @@ import ns from '../ns'
1111import { AccessController } from './access-controller'
1212import { AgentMapMap , ComboList , PartialAgentTriple } from './types'
1313import { AddAgentButtons } from './add-agent-buttons'
14+ import { debug } from '../debug'
1415
1516const ACL = ns . acl
1617
@@ -175,18 +176,18 @@ export class AccessGroups {
175176 const agent = findAgent ( uri , this . store ) // eg 'agent', 'origin', agentClass'
176177 const thing = sym ( uri )
177178 if ( ! agent && ! secondAttempt ) {
178- console . log ( ` Not obvious: looking up dropped thing ${ thing } ` )
179+ debug . log ( ` Not obvious: looking up dropped thing ${ thing } ` )
179180 try {
180181 await ( this . store as any ) . fetcher . load ( thing . doc ( ) )
181182 } catch ( error ) {
182183 const message = `Ignore error looking up dropped thing: ${ error } `
183- console . error ( message )
184+ debug . error ( message )
184185 return Promise . reject ( new Error ( message ) )
185186 }
186187 return this . handleDroppedUri ( uri , combo , true )
187188 } else if ( ! agent ) {
188189 const error = ` Error: Drop fails to drop appropriate thing! ${ uri } `
189- console . error ( error )
190+ debug . error ( error )
190191 return Promise . reject ( new Error ( error ) )
191192 }
192193 this . setACLCombo ( combo , uri , agent , this . controller . subject )
@@ -198,7 +199,7 @@ export class AccessGroups {
198199 }
199200 this . removeAgentFromCombos ( uri ) // Combos are mutually distinct
200201 this . byCombo [ combo ] . push ( [ res . pred , res . obj . uri ] )
201- console . log ( `ACL: setting access to ${ subject } by ${ res . pred } : ${ res . obj } ` )
202+ debug . log ( `ACL: setting access to ${ subject } by ${ res . pred } : ${ res . obj } ` )
202203 }
203204
204205 private removeAgentFromCombos ( uri : string ) : void {
@@ -242,7 +243,7 @@ function findAgent (uri, kb): PartialAgentTriple | null {
242243 const obj = sym ( uri )
243244 const types = kb . findTypeURIs ( obj )
244245 for ( const ty in types ) {
245- console . log ( ' drop object type includes: ' + ty )
246+ debug . log ( ' drop object type includes: ' + ty )
246247 }
247248 // An Origin URI is one like https://fred.github.io eith no trailing slash
248249 if ( uri . startsWith ( 'http' ) && uri . split ( '/' ) . length === 3 ) {
@@ -256,7 +257,7 @@ function findAgent (uri, kb): PartialAgentTriple | null {
256257 uri . endsWith ( '/' )
257258 ) {
258259 // there IS third slash
259- console . log ( 'Assuming final slash on dragged origin URI was unintended!' )
260+ debug . log ( 'Assuming final slash on dragged origin URI was unintended!' )
260261 return { pred : 'origin' , obj : sym ( uri . slice ( 0 , - 1 ) ) } // Fix a URI where the drag and drop system has added a spurious slash
261262 }
262263
@@ -288,6 +289,6 @@ function findAgent (uri, kb): PartialAgentTriple | null {
288289 if ( ns . solid ( 'AppProviderClass' ) . uri in types ) {
289290 return { pred : 'originClass' , obj : obj }
290291 }
291- console . log ( ' Triage fails for ' + uri )
292+ debug . log ( ' Triage fails for ' + uri )
292293 return null
293294}
0 commit comments