chat-pane 2.4.23-d7dc428f → 2.4.23-d8f86fc6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79246,7 +79246,13 @@ const longChatPane = {
79246
79246
  if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) {
79247
79247
  // subject is the object
79248
79248
  return 'Chat channnel'
79249
- } // Looks like a message -- might not havre any class declared
79249
+ }
79250
+ if (kb.holds(subject, ns.rdf('type'), ns.sioc('Thread'))) {
79251
+ // subject is the object
79252
+ return 'Thread'
79253
+ }
79254
+
79255
+ // Looks like a message -- might not havre any class declared
79250
79256
  if (
79251
79257
  kb.any(subject, ns.sioc('content')) &&
79252
79258
  kb.any(subject, ns.dct('created'))
@@ -79277,6 +79283,31 @@ const longChatPane = {
79277
79283
  kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)
79278
79284
  }
79279
79285
 
79286
+ const aclBody = (me) => `
79287
+ @prefix : <#>.
79288
+ @prefix acl: <http://www.w3.org/ns/auth/acl#>.
79289
+ @prefix foaf: <http://xmlns.com/foaf/0.1/>.
79290
+ @prefix lon: <./>.
79291
+
79292
+ :ControlReadWrite
79293
+ a acl:Authorization;
79294
+ acl:accessTo lon:;
79295
+ acl:agent <${me.uri}>;
79296
+ acl:default lon:;
79297
+ acl:mode acl:Control, acl:Read, acl:Write.
79298
+ :Read
79299
+ a acl:Authorization;
79300
+ acl:accessTo lon:;
79301
+ acl:agentClass foaf:Agent;
79302
+ acl:default lon:;
79303
+ acl:mode acl:Read.
79304
+ :ReadAppend
79305
+ a acl:Authorization;
79306
+ acl:accessTo lon:;
79307
+ acl:agentClass acl:AuthenticatedAgent;
79308
+ acl:default lon:;
79309
+ acl:mode acl:Read, acl:Append.`
79310
+
79280
79311
  return new Promise(function (resolve, reject) {
79281
79312
  updater.put(
79282
79313
  newChatDoc,
@@ -79294,6 +79325,18 @@ const longChatPane = {
79294
79325
  }
79295
79326
  }
79296
79327
  )
79328
+ // newChat container authenticated users Append only
79329
+ .then((result) => {
79330
+ return new Promise((resolve, reject) => {
79331
+ if (newPaneOptions.me) {
79332
+ kb.fetcher.webOperation('PUT', newPaneOptions.newBase + '.acl', {
79333
+ data: aclBody(newPaneOptions.me),
79334
+ contentType: 'text/turtle'
79335
+ })
79336
+ }
79337
+ resolve(newPaneOptions)
79338
+ })
79339
+ })
79297
79340
  })
79298
79341
  },
79299
79342
 
@@ -79514,12 +79557,21 @@ const longChatPane = {
79514
79557
 
79515
79558
  var chatChannel = subject
79516
79559
  var selectedMessage = null
79560
+ var thread = null
79517
79561
  if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) {
79518
79562
  // subject is the chatChannel
79519
79563
  console.log('Chat channnel')
79520
79564
 
79521
79565
  // Looks like a message -- might not havre any class declared
79522
- } else if (
79566
+ } else if (kb.holds(subject, ns.rdf('type'), ns.sioc('Thread'))) {
79567
+ // subject is the chatChannel
79568
+ console.log('Thread is subject')
79569
+ thread = subject
79570
+ const rootMessage = kb.the(null, ns.sioc('has_reply'), thread, thread.doc())
79571
+ if (!rootMessage) throw new Error('Thread has no root message ' + thread)
79572
+ chatChannel = kb.any(null, ns.wf('message'), rootMessage)
79573
+ if (!chatChannel) throw new Error('Thread root has no link to chatChannel')
79574
+ } else if ( // Looks like a message -- might not havre any class declared
79523
79575
  kb.any(subject, ns.sioc('content')) &&
79524
79576
  kb.any(subject, ns.dct('created'))
79525
79577
  ) {
@@ -79630,7 +79682,11 @@ const longChatPane = {
79630
79682
  // This is the top pane, title, scrollbar etc are ours
79631
79683
  options.solo = true
79632
79684
  }
79633
- options.showThread = showThread
79685
+ if (thread) { // Rendereing a thread as first class object
79686
+ options.thread = thread
79687
+ } else { // either show thread *or* allow new threads. Threads don't nest but they could
79688
+ options.showThread = showThread
79689
+ }
79634
79690
  const chatControl = await solid_ui__WEBPACK_IMPORTED_MODULE_1__.infiniteMessageArea(
79635
79691
  dom,
79636
79692
  kb,