gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf15-navigate3b3e451f|||PR ident#36 navigate to the app instead of location.assignmref15-navigate/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

  • 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
  • 45e55303ident#42: an app write patches one row: upsert on create, edit and new secret, one-argument remove on delete; the faces answer the changed app (or the deleted id), not the whole listmre
  • 991641d4Merge branch 'f10-access' into mainIdent
  • e56d8273|||PR ident#34 part 4: access and inbox fixed classesmre
  • df7696dbident#34: tests: access ticks selector quoting fixmre
  • 7215903eident#34: access: the unstyled classes all, app, tick, apptick, plus are dropped; the gate finds the app ticks by input[name=app]mre
  • 69b0a0ceident#34: access: the pick buttons use Style.pickCard instead of class pickmre
  • dc702419Merge branch 'f9-choose' into mainIdent
  • 8caec771|||PR ident#34 restore .choose hookmre
  • 0dbff960Merge branch 'f8-shared' into mainIdent
  • d69665f6|||PR ident#34 part 3: shared look classes (wide, avatar, chip/used, conn, choose, who, inboxlink) moved to statics or droppedmre