gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit31cabfcc31cabfccmission 021: E2E script, report, LOG, STATUSmre31cabfcc/components/inbox.hl

3.0 KB

  1. // components/inbox.hl — `/inbox` (ticket #20): the tickets ASSIGNED TO YOU, in two lists: pending and
  2. // review, across all projects. Personal: needs a login. Live: a ticket assigned to you, or moving into
  3. // or out of those states, appears / disappears without a reload.
  4. parent './main.hl'
  5. import { inboxRows } from '../lib/tickets.hl'
  6. import { siteName } from '../project.hl'
  7. import { userOfSession } from '../lib/users.hl'
  8. session = null
  9. myId = userOfSession(session) != null ? userOfSession(session).id : ''
  10. loggedIn = myId != ''
  11. loggedOut = myId == ''
  12. box = inboxRows(userOfSession(session))
  13. pending = box.pending
  14. review = box.review
  15. noPending = pending.length == 0
  16. noReview = review.length == 0
  17. __title = siteName + ' | inbox'
  18. View {
  19. ticketBoard {
  20. h1 { id = "heading" "Inbox" }
  21. if (loggedOut) { p { id = "loginhint" class = "hint" "Log in with ident (top right) to see the tickets assigned to you." } }
  22. if (loggedIn) {
  23. section { id = "reviewbox"
  24. h2 { "Review" }
  25. if (noReview) { p { id = "reviewempty" class = "empty" "Nothing is waiting for your review." } }
  26. ol { id = "review" class = "tickets"
  27. for (row of review) {
  28. li {
  29. ticketState { class = row.stateSlug row.state }
  30. a { class = "subject" href = row.href ticketRef { row.ref } row.subject }
  31. ticketMeta {
  32. a { href = row.projectHref row.projectTitle }
  33. time { row.updated }
  34. }
  35. }
  36. }
  37. }
  38. }
  39. section { id = "pendingbox"
  40. h2 { "Pending" }
  41. if (noPending) { p { id = "pendingempty" class = "empty" "Nothing is pending for you." } }
  42. ol { id = "pending" class = "tickets"
  43. for (row of pending) {
  44. li {
  45. ticketState { class = row.stateSlug row.state }
  46. a { class = "subject" href = row.href ticketRef { row.ref } row.subject }
  47. ticketMeta {
  48. a { href = row.projectHref row.projectTitle }
  49. time { row.updated }
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. // a row goes to the top of its list if it is assigned to me and in that state, and out of both otherwise
  59. place = (row) => {
  60. p = []
  61. r = []
  62. if (row.assigneeId == myId && row.state == 'pending') { p.push(row) }
  63. if (row.assigneeId == myId && row.state == 'review') { r.push(row) }
  64. for (x of pending) { if (x.id != row.id) { p.push(x) } }
  65. for (x of review) { if (x.id != row.id) { r.push(x) } }
  66. pending = p
  67. review = r
  68. noPending = p.length == 0
  69. noReview = r.length == 0
  70. }
  71. on client ticketCreated(row) { place(row) }
  72. on client ticketEvent(ticketId, ev, row) { place(row) }
  73. on client signedIn(tag, info) {
  74. b = emit server myInbox()
  75. if (b != null && b.pending != null) {
  76. pending = b.pending
  77. review = b.review
  78. noPending = b.pending.length == 0
  79. noReview = b.review.length == 0
  80. myId = b.me
  81. loggedIn = true
  82. loggedOut = false
  83. }
  84. }
  85. on client signedOut(tag) {
  86. myId = ''
  87. loggedIn = false
  88. loggedOut = true
  89. }
  90. on server myInbox(session) {
  91. u = userOfSession(session)
  92. if (u == null) { return { error = 'log in first' } }
  93. b = inboxRows(u)
  94. return { pending = b.pending review = b.review me = u.id }
  95. }

Branches

Latest commits

  • 31cabfccmission 021: E2E script, report, LOG, STATUSmre
  • 6aea8683editor look: .empty rule only for p.empty, files off where tickets has no upload, state note one line, events test scrolls the editor into view; synced md-editor (components d702d76+6f27ad3); gate 377/0, events 52/0mre
  • dce6ffa6Merge branch 'w28-deflake'mre
  • 536092a1tickets (mission 019): de-flake the m016 comment clicks (B: unliked) — calmClick waits until the button stops moving; test only, no app changemre
  • 9c5fd42amission 020: attachments E2E proof (lisbeth Chrome, real-data copy), reportmre
  • 1206404fREADME attachments, report 018, LOG/STATUSmre
  • 3d9e7f3ctests: m017 gate fixes (list count, waits before delete clicks); gate 373/0mre
  • dd41d5bcre-sync components 15be2ac; mission 018mre
  • 420ad1bbtickets (mission 017 WIP, tickets#27): comment attachments — lib/attachments.hl (storage/attachments, limits, type by content, members-only GET /api/attachments/:id, delete drops, edit keeps), multipart POST …/comments (lib/multipart.hl), Respond block in FilesUpload (blocks verbatim from components w27c 1f8d79d), gate m017 checks written (not yet run); report, LOG, STATUSmre
  • a7a1380dmission brief 017mre
  • f83d9c0dtickets (mission 016): report reports/016-comments-block.md, LOG, STATUS, README gate countmre
  • eef80f55tickets (mission 016): comments through the shared Comments block (layouts#2) — edit (author, earlier versions kept), delete (author, asks; leaves one line in the history), like (members, toggle) on the server (lib/comments.hl, append-only tables), faces + API …/comments/:comment/{edit,delete,like}, push commentChanged; every run of comments is a block in place in the history; Markdown fields on the Hybriel MdEditor (shared/md-editor.js retired: it took over the block's <md-editor>); blocks copied verbatim from components.hybriel 9db927d (tools/sync-components.sh); gates browser 351/0 (old 326/0), events 52/0 (old 52/0)mre
  • eb7aeeb9mission brief 016mre
  • e4c34759paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • 26efb23freport w6-events (events test)mre
  • c6bfab04mission 015: re-vendor Hybriel 0f396652 (static build), reportmre
  • b7ec5981mission brief 015mre
  • 5dc68731docker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
  • 8a460b16mission 014: Apollo's 'stream opened right after the start gets no live events' is not a tickets bug — events.mjs checks early streamsmre
  • 6309ca81mission brief 014mre