contacts-pane 2.6.3 → 2.6.4-31163ac2

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.
package/.eslintrc CHANGED
File without changes
File without changes
package/.nvmrc CHANGED
File without changes
package/LICENSE.md CHANGED
File without changes
package/Makefile CHANGED
File without changes
package/README.md CHANGED
File without changes
package/card.ai CHANGED
File without changes
package/card.png CHANGED
File without changes
package/contactLogic.js CHANGED
File without changes
package/contactsPane.js CHANGED
File without changes
package/diff.txt CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -15,7 +15,18 @@ export async function renderGroupMemberships (person, context) {
15
15
  async function removeFromGroup (thing, group) {
16
16
  const pname = kb.any(thing, ns.vcard('fn'))
17
17
  const gname = kb.any(group, ns.vcard('fn'))
18
- const groups = kb.each(null, ns.vcard('hasMember'), thing)
18
+ // find all WebIDs of thing
19
+ const thingwebids = kb.each(null, ns.owl('sameAs'), thing, group.doc())
20
+ // WebID can be deleted only if not used in another thing
21
+ let webids = []
22
+ thingwebids.map(webid => {
23
+ if (kb.any(webid, ns.owl('sameAs'), thing, group.doc()).length = 1 ) webids = webids.concat(webid)
24
+ }
25
+ )
26
+ // const webids = kb.any(webid, ns.owl('sameAs'))
27
+ let thingOrWebid = thing
28
+ if (webids.length > 0) thingOrWebid = kb.sym(webids[0])
29
+ const groups = kb.each(null, ns.vcard('hasMember'), thingOrWebid)
19
30
  if (groups.length < 2) {
20
31
  alert(
21
32
  'Must be a member of at least one group. Add to another group first.'
@@ -24,9 +35,10 @@ export async function renderGroupMemberships (person, context) {
24
35
  }
25
36
  const message = 'Remove ' + pname + ' from group ' + gname + '?'
26
37
  if (confirm(message)) {
27
- const del = kb
38
+ let del = kb
28
39
  .statementsMatching(person, undefined, undefined, group.doc())
29
40
  .concat(kb.statementsMatching(undefined, undefined, person, group.doc()))
41
+ webids.map(webid => del.concat(kb.statementsMatching(undefined,undefined, webid, group.doc())))
30
42
  kb.updater.update(del, [], function (uri, ok, err) {
31
43
  if (!ok) {
32
44
  const message = 'Error removing member from group ' + group + ': ' + err
@@ -52,9 +64,11 @@ export async function renderGroupMemberships (person, context) {
52
64
  return tr
53
65
  }
54
66
 
67
+ // find all documents where person ns.vcard('fn')
55
68
  function syncGroupList () {
56
- const groups = kb.each(null, ns.vcard('hasMember'), person)
57
-
69
+ // to be changed person and or webids
70
+ // const groups = kb.each(null, ns.vcard('hasMember'), person)
71
+ const groups = kb.each(person, ns.vcard('fn'), undefined) // non il faut acceder a la liste des group.doc()
58
72
  utils.syncTableToArray(groupList, groups, newRowForGroup)
59
73
  }
60
74
 
package/individual.js CHANGED
File without changes
package/individualForm.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/lib/forms.js CHANGED
File without changes
File without changes
package/lib/publicData.js CHANGED
File without changes
package/lib/vcard.js CHANGED
File without changes
@@ -1,6 +1,7 @@
1
1
  import * as UI from 'solid-ui'
2
- import { setACLUserPublic } from 'solid-logic'
2
+ import { solidLogicSingleton } from 'solid-logic'
3
3
 
4
+ const { setACLUserPublic } = solidLogicSingleton.acl
4
5
  // const mime = require('mime-types')
5
6
  // const toolsPane0 = require('./toolsPane')
6
7
  // const toolsPane = toolsPane0.toolsPane
package/mugshotGallery.js CHANGED
@@ -200,8 +200,18 @@ export function renderMugshotGallery (dom, subject) {
200
200
  droppedFileHandler
201
201
  )
202
202
  if (image) {
203
- img.setAttribute('src', image.uri)
203
+ // img.setAttribute('src', image.uri) use token and works with NSS but not with CSS
204
+ // we need to get image with authenticated fetch
205
+ store.fetcher._fetch(image.uri)
206
+ .then(function(response) {
207
+ return response.blob()
208
+ })
209
+ .then(function(myBlob) {
210
+ const objectURL = URL.createObjectURL(myBlob)
211
+ img.setAttribute('src', objectURL)
212
+ })
204
213
  UI.widgets.makeDraggable(img, image)
214
+
205
215
  }
206
216
  return img
207
217
  }
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contacts-pane",
3
- "version": "2.6.3",
3
+ "version": "2.6.4-31163ac2",
4
4
  "description": "Contacts Pane: Contacts manager for Address Book, Groups, and Individuals.",
5
5
  "main": "./contactsPane.js",
6
6
  "scripts": {
@@ -10,8 +10,8 @@
10
10
  "lint": "eslint '*.js'",
11
11
  "lint-fix": "eslint '*.js' --fix",
12
12
  "test": "npm run lint",
13
- "prepublishOnly": "npm test && npm run build",
14
- "postpublish": "git push origin main --follow-tags"
13
+ "ignore:prepublishOnly": "npm test && npm run build",
14
+ "ignore:postpublish": "git push origin main --follow-tags"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -37,19 +37,19 @@
37
37
  },
38
38
  "homepage": "https://github.com/solid/contacts-pane",
39
39
  "dependencies": {
40
- "pane-registry": "^2.4.10",
41
- "rdflib": "^2.2.19",
42
- "solid-logic": "^1.3.17",
43
- "solid-ui": "^2.4.22"
40
+ "pane-registry": "2.4.12",
41
+ "rdflib": "^2.2.20",
42
+ "solid-logic": "2.0.0",
43
+ "solid-ui": "2.4.23"
44
44
  },
45
45
  "devDependencies": {
46
- "@typescript-eslint/eslint-plugin": "^5.19.0",
47
- "@typescript-eslint/parser": "^5.19.0",
48
- "eslint": "^8.13.0",
46
+ "@typescript-eslint/eslint-plugin": "^5.36.1",
47
+ "@typescript-eslint/parser": "^5.36.1",
48
+ "eslint": "^8.23.0",
49
49
  "eslint-plugin-import": "^2.26.0",
50
- "husky": "^7.0.4",
51
- "lint-staged": "^12.3.7",
52
- "typescript": "^4.6.3",
50
+ "husky": "^8.0.1",
51
+ "lint-staged": "^13.0.3",
52
+ "typescript": "^4.8.2",
53
53
  "typescript-transpile-only": "0.0.4"
54
54
  },
55
55
  "husky": {
File without changes
File without changes
File without changes
File without changes
package/src/forms.ttl CHANGED
File without changes
File without changes
package/src/publicData.ts CHANGED
File without changes
package/src/vcard.ttl CHANGED
File without changes
package/toolsPane.js CHANGED
File without changes
package/webidControl.js CHANGED
@@ -51,12 +51,18 @@ export async function addWebIDToContacts (person, webid, urlType, kb) {
51
51
  $rdf.st(vcardURLThing, ns.rdf('type'), urlType, person.doc()),
52
52
  $rdf.st(vcardURLThing, ns.vcard('value'), webid, person.doc())
53
53
  ]
54
+ // insert webID in groups
55
+ // replace person with webId in vcard:hasMember (webId may already exist)
56
+ // insert owl:sameAs
54
57
  const groups = kb.each(null, ns.vcard('hasMember'), person)
58
+ const deletables = []
55
59
  groups.forEach(group => {
60
+ deletables.push($rdf.st(group, ns.vcard('hasMember'), person, group.doc()))
61
+ insertables.push($rdf.st(group, ns.vcard('hasMember'), kb.sym(webid), group.doc())) // may exist do we need to check ?
56
62
  insertables.push($rdf.st(person, ns.owl('sameAs'), kb.sym(webid), group.doc()))
57
63
  })
58
64
  try {
59
- await updateMany([], insertables)
65
+ await updateMany(deletables, insertables)
60
66
  } catch (err) { throw new Error(`Could not create webId ${WEBID_NOUN}: ${webid}.`) }
61
67
  }
62
68
 
@@ -79,12 +85,17 @@ export async function removeWebIDFromContacts (person, webid, urlType, kb) {
79
85
  await kb.updater.update(deletables, [])
80
86
 
81
87
  // remove webIDs from groups
82
- const groups = kb.each(null, ns.vcard('hasMember'), person)
88
+ const groups = kb.each(null, ns.vcard('hasMember'), kb.sym(webid))
83
89
  const removeFromGroups = []
90
+ const insertInGroups = []
84
91
  groups.forEach(group => {
85
92
  removeFromGroups.push($rdf.st(person, ns.owl('sameAs'), kb.sym(webid), group.doc()))
93
+ if (kb.each(null, ns.owl('sameAs'), kb.sym(webid), group.doc()).length = 1) {
94
+ removeFromGroups.push($rdf.st(group, ns.vcard('hasMember'), kb.sym(webid)), group.doc())
95
+ insertInGroups.push($rdf.st(group, ns.vcard('hasMember'), person, group.doc()))
96
+ }
86
97
  })
87
- await updateMany(removeFromGroups)
98
+ await updateMany(removeFromGroups, insertInGroups)
88
99
  }
89
100
 
90
101
  // Trace things the same as this - other IDs for same thing