gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf18b-shell-session19868218|||PR ident#39 shell reads its session member instead of a cross-file emitmref18b-shell-session/lib/invites-helpers.hl

1.4 KB

  1. // lib/invites-helpers.hl — what lib/invites.hl looks up: the text and number checks of the app's call, the
  2. // list of identities that accepted, the message of a state. No table access. Statics only.
  3. import { hasControl } from './util.hl'
  4. static maxText = 60
  5. static isWhole = (n) => { return hlTypeName(n) == 'Number' && !('' + n).includes('.') && !('' + n).includes('e') }
  6. static checkText = (v, name) => {
  7. if (v == null || hlTypeName(v) != 'String') { return { error = 'field ' + name + ' must be a string' } }
  8. t = v.trim()
  9. if (t == '') { return { error = 'field ' + name + ' is empty' } }
  10. if (t.length > maxText) { return { error = 'field ' + name + ' is longer than ' + maxText + ' characters' } }
  11. if (hasControl(t)) { return { error = 'field ' + name + ' contains a control character' } }
  12. return { text = t }
  13. }
  14. // `acceptedBy` is 'a b c': the identities' short ids that accepted it, space separated
  15. static acceptedList = (rec) => { return rec.acceptedBy == null || rec.acceptedBy == '' ? [] : rec.acceptedBy.split(' ') }
  16. static usedCount = (rec) => { return acceptedList(rec).length }
  17. // the message of a state that cannot be accepted
  18. static problemOf = (state) => {
  19. if (state == 'used') { return 'This invitation was already used.' }
  20. if (state == 'expired') { return 'This invitation has expired. Ask whoever invited you for a new one.' }
  21. if (state == 'revoked') { return 'This invitation was withdrawn. Ask whoever invited you for a new one.' }
  22. return ''
  23. }

Branches

Latest commits

  • 19868218|||PR ident#39 shell reads its session member instead of a cross-file emitmre
  • 5d1b3fedMerge branch 'v61-day61' into mainIdent
  • 83faeb15|||PR ident: vendor Hybriel day61mre
  • b2572b34Merge branch 'v59-day59' into mainIdent
  • 67cf016d|||PR ident: vendor Hybriel day59mre
  • 600c043dMerge branch 'v58-day58' into mainIdent
  • 365f8c80|||PR ident: vendor Hybriel day58mre
  • 585126e5Merge branch 'f16-setf' into mainIdent
  • 953bf03a|||PR ident setF mirror dropped (hybriel#370)mre
  • a1419d9cMerge branch 'f15-navigate' into mainIdent
  • 3b3e451f|||PR ident#36 navigate to the app instead of location.assignmre
  • e36f4516Merge branch 'f14-online' into mainIdent
  • 2c5eac91|||PR ident#38 online state without probe timermre
  • bf1980f2Merge branch 'v56-day56' into mainIdent
  • 62ae0adf|||PR ident: vendor Hybriel day56mre
  • 0d18abc4Merge branch 'f13-avatar' into mainIdent
  • 2a99730a|||PR ident#37 avatar in hlmre
  • fa4ed25bMerge branch 'f11-upsert' into mainIdent
  • 8f3d9bc9|||PR ident#42 keyed upsert and removemre
  • 675493b1ident#42: editing an identity upserts the one edited row (face editIdentity answers { identity, row }); a create or delete keeps the whole list because the rows' position-dependent parts (default, Delete, Identity n) changemre