Skip to content

Commit bc634c1

Browse files
authored
Merge pull request #160 from solid/dom-to-context
Making use of the new context object
2 parents 3cd90fe + cea42a2 commit bc634c1

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/acl-control.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ UI.aclControl.shortNameForFolder = function (x) {
6666
return str || '/'
6767
}
6868

69-
UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
69+
UI.aclControl.ACLControlBox5 = function (subject, context, noun, kb, callback) {
70+
const dom = context.dom
7071
var updater = kb.updater || new $rdf.UpdateManager(kb)
7172
var ACL = UI.ns.acl
7273
var doc = subject.doc() // The ACL is actually to the doc describing the thing
@@ -603,9 +604,9 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
603604
'A Web App (origin)',
604605
async event => {
605606
removeOthers(event.target)
606-
var context = { div: bar, dom }
607-
await UI.authn.logInLoadProfile(context)
608-
var trustedApps = kb.each(context.me, ns.acl('trustedApp'))
607+
var eventContext = { div: bar, dom }
608+
await UI.authn.logInLoadProfile(eventContext)
609+
var trustedApps = kb.each(eventContext.me, ns.acl('trustedApp'))
609610
var trustedOrigins = trustedApps.flatMap(app =>
610611
kb.each(app, ns.acl('origin'))
611612
)
@@ -640,10 +641,12 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
640641
table.style = 'margin: em; background-color: #eee;'
641642

642643
// Add the Trusted App pane for managing you set of apps
643-
var trustedAppControl = window.panes.trustedApplications.render(
644-
context.me,
645-
dom,
646-
{}
644+
const trustedApplications = context.session.paneRegistry.byName(
645+
'trustedApplications'
646+
)
647+
const trustedAppControl = trustedApplications.render(
648+
eventContext.me,
649+
context
647650
)
648651
trustedAppControl.style.borderColor = 'orange'
649652
trustedAppControl.style.borderWidth = '0.1em'

src/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function newThingUI (context, thePanes) {
8585
newPaneOptions.newBase
8686
)
8787
options.pane
88-
.mintNew(newPaneOptions)
88+
.mintNew(context, newPaneOptions)
8989
.then(function (newPaneOptions) {
9090
if (!newPaneOptions || !newPaneOptions.newInstance) {
9191
throw new Error('Cannot mint new - missing newInstance')

src/widgets/buttons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ buttons.openHrefInOutlineMode = function (e) {
663663
if (!uri) return console.log('openHrefInOutlineMode: No href found!\n')
664664
const dom = window.document
665665
if (dom.outlineManager) {
666+
// @@ TODO Remove the use of document as a global object
666667
dom.outlineManager.GotoSubject(
667668
UI.store.sym(uri),
668669
true,
@@ -671,6 +672,7 @@ buttons.openHrefInOutlineMode = function (e) {
671672
undefined
672673
)
673674
} else if (window && window.panes && window.panes.getOutliner) {
675+
// @@ TODO Remove the use of window as a global object
674676
window.panes
675677
.getOutliner()
676678
.GotoSubject(UI.store.sym(uri), true, undefined, true, undefined)

0 commit comments

Comments
 (0)