gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commita81abdc9a81abdc9gitoria#34: org page via function route, member-reachable orgs, selects, reportmrea81abdc9/lib/members.hl

1.8 KB

  1. // lib/members.hl — THE MEMBER LIST (ticket gitoria#34, GO34; the same list ident#27 "agent pushes only where added as collaborator" will ask).
  2. // One hl:mpackdb table, storage/mpackdb/members.db: pk @id index !pair, ref { ref, user (users @id), pair (ref|user), created }
  3. // ref = 'r:<repo full name>' (a repo) | 'o:<org>' (every repo of an organization). A member sees a private repo and may push to it.
  4. import { MPackDB } from 'hl:mpackdb'
  5. import { now } from 'hl:time'
  6. import { storageDir, countOfList } from './util.hl'
  7. static membersTable = new MPackDB(file = storageDir + '/members.db', primaryKey = '@id', indexes = ['!pair', 'ref'])
  8. static refOfRepo = (slug) => { return 'r:' + slug }
  9. static refOfOrg = (org) => { return 'o:' + org }
  10. static isMember = (ref, userId) => {
  11. if (userId == null) { return false }
  12. return countOfList(membersTable.find('pair', ref + '|' + userId)) > 0
  13. }
  14. // the users @ids on a list
  15. static memberIds = (ref) => {
  16. out = []
  17. all = membersTable.find('ref', ref)
  18. if (countOfList(all) == 0) { return out }
  19. for (m of all) { out.push(m.user) }
  20. return out
  21. }
  22. static addMember = (ref, userId) => {
  23. if (isMember(ref, userId)) { return true }
  24. id = membersTable.put({ ref = ref user = userId pair = ref + '|' + userId created = now() })
  25. return id != null
  26. }
  27. static removeMember = (ref, userId) => {
  28. all = membersTable.find('pair', ref + '|' + userId)
  29. if (countOfList(all) == 0) { return false }
  30. for (m of all) { membersTable.delete(m.id) }
  31. return true
  32. }
  33. // a repo that moved or was renamed keeps its list
  34. static moveMembers = (fromRef, toRef) => {
  35. all = membersTable.find('ref', fromRef)
  36. if (countOfList(all) == 0) { return null }
  37. for (m of all) {
  38. membersTable.delete(m.id)
  39. membersTable.put({ ref = toRef user = m.user pair = toRef + '|' + m.user created = m.created })
  40. }
  41. return null
  42. }

Branches

Latest commits

  • a81abdc9gitoria#34: org page via function route, member-reachable orgs, selects, reportmre
  • 17f031f0gitoria#34: private repos, organizations, members, move tool, gatemre
  • 71b69343gitoria#23: the sidebar's Repositories link was a 404 after any in-page navigation (static menu re-evaluated publicUrl in the browser); the menu is an instance property now; gate taps it after a tab, folder, filemre
  • 90b4f728gitoria#25: restore the homepage cache and the parsed-blocks cache (they store data under immutable keys, no HTML); the page key, the framework readme key and the textHash key stay removedmre
  • a487248cgitoria#25: remove every cache that hid the page build (page key, Markdown render key, homepage cache, parsed-blocks cache) and the gate that only tested themmre
  • 12f2f4fegitoria: re-vendor Hybriel set-day27b, a startup fault in on Error exits 1mre
  • c21c084egitoria: write the standby service out in full so the boot gate can read the main servicemre
  • e307d69agitoria: say what is per process during the hand-overmre
  • f0cbe6a6gitoria: standby service on port 45014 and a deploy that hands over through it without a gapmre
  • 727cd083gitoria#25: README: vendor notes for Hybriel c1b1010f and the page cachemre
  • 61b72dedgitoria#25: re-vendor Hybriel master c1b1010f (W149 page cache), key the repo Readme page by slug and main commit, extend the readme-cache gatemre
  • 5b0b4b9ereadme-cache gate: use the security gate's ports when no own ports are givenmre
  • bc8f20d9gitoria#25: re-vendor Hybriel c09538bb with the W141 render cache, cache the homepage per commit, add the readme-cache gatemre
  • 9feebbd3Re-vendor Hybriel to ded47c13 (W145: Firefox start script fix)mre
  • 28ed41e5gitoria#24: one sign-in comes from hl:web batch 20, the /session/share workaround is gonemre
  • 3b2669e4gs: drop the unbuildable legacy check, fix pwa fetchmre
  • 2a2fdd77gs: C2 check before cookie experimentsmre
  • 76e0587aWIP gs 2mre
  • a80da7bdWIP gs: security gate for lazy sessions, g24 browser checksmre
  • 23fb05d8re-vendor Hybriel aaa39e69 (hl:web batch 20: login emit and Sessions.mint, tab follows a login, signed-in session cookie wins among duplicates and is re-issued with the Domain, W85 faster render, lazy sessions)mre