Skip to content

Commit

Permalink
Removing minting capabilities of Short Chat view
Browse files Browse the repository at this point in the history
As part of #17

Partial fix for #16
  • Loading branch information
megoth committed Sep 16, 2019
1 parent 823f70b commit b157c71
Showing 1 changed file with 38 additions and 31 deletions.
69 changes: 38 additions & 31 deletions shortChatPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,44 @@ module.exports = {
return null // Suppress pane otherwise
},

mintClass: ns.meeting('Chat'),

mintNew: function (newPaneOptions) {
var updater = kb.updater
if (newPaneOptions.me && !newPaneOptions.me.uri) throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)

var newInstance = newPaneOptions.newInstance = newPaneOptions.newInstance || kb.sym(newPaneOptions.newBase + 'index.ttl#this')
var newChatDoc = newInstance.doc()

kb.add(newInstance, ns.rdf('type'), ns.meeting('Chat'), newChatDoc)
kb.add(newInstance, ns.dc('title'), 'Chat', newChatDoc)
kb.add(newInstance, ns.dc('created'), new Date(), newChatDoc)
if (newPaneOptions.me) {
kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)
}

return new Promise(function (resolve, reject) {
updater.put(
newChatDoc,
kb.statementsMatching(undefined, undefined, undefined, newChatDoc),
'text/turtle',
function (uri2, ok, message) {
if (ok) {
resolve(newPaneOptions)
} else {
reject(new Error('FAILED to save new tool at: ' + uri2 + ' : ' +
message))
};
})
})
},
/*
* As part of the work on merging the existing chat views (aka panes) into one view
* https://github.com/solid/chat-pane/issues/17
* we want to dis-incentivize the use of Small Chat until we've gotten the work done
* by making it difficult to create new data resources that uses the Small Chat view
* but we still want existing resources to be viewed by the Small Chat view
*/
// mintClass: ns.meeting('Chat'),
//
// mintNew: function (newPaneOptions) {
// var updater = kb.updater
// if (newPaneOptions.me && !newPaneOptions.me.uri) throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)
//
// var newInstance = newPaneOptions.newInstance = newPaneOptions.newInstance || kb.sym(newPaneOptions.newBase + 'index.ttl#this')
// var newChatDoc = newInstance.doc()
//
// kb.add(newInstance, ns.rdf('type'), ns.meeting('Chat'), newChatDoc)
// kb.add(newInstance, ns.dc('title'), 'Chat', newChatDoc)
// kb.add(newInstance, ns.dc('created'), new Date(), newChatDoc)
// if (newPaneOptions.me) {
// kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)
// }
//
// return new Promise(function (resolve, reject) {
// updater.put(
// newChatDoc,
// kb.statementsMatching(undefined, undefined, undefined, newChatDoc),
// 'text/turtle',
// function (uri2, ok, message) {
// if (ok) {
// resolve(newPaneOptions)
// } else {
// reject(new Error('FAILED to save new tool at: ' + uri2 + ' : ' +
// message))
// };
// })
// })
// },

render: function (subject, dom) {
var complain = function complain (message, color) {
Expand Down

0 comments on commit b157c71

Please sign in to comment.