tickets
All repositories: gitoria
28.1 KB
// components/ticket.hl — `/:projectSlug/:ticketNumber` (ticket #25; was /projects/…): one ticket, its// append-only event history, a comment form and the state change. (Old URLs `/tickets/<n>`,// `/projects/<slug>/<n>`, `/projects/<slug>/tickets/<n>` are 301-redirected here by lib/api.hl.) Live: an event on THIS ticket (from any browser or// the API) is appended here and the state badge follows, without a reload.// Ticket #6 (mission 014): the summary, comments and state notes are MARKDOWN, rendered by the// child component Markdown (components/markdown.hl) from markdown.hl's blocks — safe: no HTML// string, links checked. Ticket #8: the ticket's AUTHOR (a ticket from before the login: the// creator) gets "Edit" — subject + summary; the edit is a history event that keeps the previous// values ("edited the ticket", the previous summary folded under it), pushed live like a comment.// Ticket #4 (mission 017): RELATIONS — "Part of <parent>", the children with their states and// "all children confirmed" / "n of m children confirmed", "Blocked by" and "Blocks" (each with// states); logged-in users get the forms "Parent" (set / remove) and "Blocked by" (add / remove per// row) — the store decides who may (the author of either ticket, or the creator). Live: the// `ticketsRelated` push carries the relation view of every ticket involved in a write.// Ticket #12 (mission 024): the Markdown fields are edited visually; since mission 016 with the Hybriel MdEditor (below).// Ctrl/Cmd+Enter in an editor sends its form.// Ticket #20 (roles): a member of the project may comment; `use` also moves the ticket between open and// review; `edit` / `admin` edit it, assign it (a member; "Assigned to …" is shown) and set any state; a// visitor without a role only reads. The server decides in every case; the page only shows what it may.// A ticket opened through a FORMER slug of its project shows a note with the current address.// Mission 016 (layouts#2): THE COMMENTS are drawn by the shared Comments block (components/comments/, copied verbatim from// components.hybriel.worldapi.org — tools/sync-components.sh): in the history every run of comments that follow each other is// one block, in place between the state changes etc. (`entries`, entriesOf); "write a comment" is a last block under// "Respond". The block shows Edit / Delete on the user's own comments (it asks before a delete) and a like; it tells this// page through the four functions it is handed (posted / edited / deleted / liked), the faces below write (lib/comments.hl// decides who may: the author edits and deletes, any member likes), and the push `commentChanged` swaps the row in every// open page. A deleted comment stays one line in the history ("commented (deleted …)"). Signed out / no member: user ''// (read only). The block's count line and its form are hidden inside the history (styles.hl): it has no switch for them.// The Markdown fields (edit summary, state note) are the Hybriel MdEditor (components/md-editor/, the block's editor); the// old <md-editor> of shared/md-editor.js is gone — it would have taken over the block's own <md-editor> elements.// tickets#27 (mission 017): ATTACHMENTS. The "Respond" block has attach = "true": its form sits in the shared FilesUpload (pick// mode; components/files-upload/, copied verbatim) — files chosen, photographed, dropped or pasted (Ctrl+V, also into the editor)// wait under it and go with the post (face commentWithFiles; lib/attachments.hl checks and stores them). Each comment shows its// files: pictures as thumbnails that open the full picture, other files as rows. Only members may fetch them, so for anybody else// the block gets the files without `url` (names and sizes, no link).parent './main.hl'import { ticketRowAt, ticketRecord, eventRows, stateChoices, addComment, changeComment, changeState, assignTicket, editTicket, mayEditId, ticketRights, relatedViews, setParent, changeBlocker } from '../lib/tickets.hl'import { assignChoices, isMember } from '../lib/projects.hl'import { relationViewOf, noRef } from '../lib/tickets-helpers.hl'import { pageEventsOf, pageEventOf } from '../lib/events.hl'import { markdownBlocks } from '../lib/markdown.hl'import { siteName } from '../project.hl'import { canWriteSession, writerOfSession, userOfSession } from '../lib/users.hl'import Markdown from './markdown.hl'import Comments from './comments/comments.hl'import MdEditor from './md-editor/md-editor.hl'projectSlug = nullticketNumber = nullrow = ticketRowAt(projectSlug, ticketNumber)present = row != nullgone = row == nullticketId = row != null ? row.id : ''ref = row != null ? row.ref : ''movedNote = row != null && projectSlug != row.projectcurrentHref = row != null ? row.href : ''assignee = row != null ? row.assignee : ''hasAssignee = row != null && row.hasAssigneecreatedBy = row != null ? row.createdBy : ''hasOld = row != null && row.hasOldoldRef = row != null ? row.oldRef : ''subject = row != null ? row.subject : 'No such ticket'summary = row != null ? row.summary : ''hasSummary = row != null && row.summary != ''summaryMd = row != null ? markdownBlocks(row.summary) : []project = row != null ? row.project : ''projectHref = row != null ? row.projectHref : '/'state = row != null ? row.state : ''stateSlug = row != null ? row.stateSlug : ''created = row != null ? row.created : ''updated = row != null ? row.updated : ''events = row != null ? pageEventsOf(eventRows(row.id)) : []__title = siteName + ' | ' + (row != null ? row.project + ' ' + row.ref + ' ' + row.subject : 'no such ticket')// the forms: only for a logged-in user with a display name (ticket #7); the author is that// user (the faces read the session). Confirm / reject: the server refuses a non-creator.session = nullme = userOfSession(session)canWrite = row != null && me != null && isMember(row.projectId, me)mustLogIn = me == nullnotMember = me != null && !canWriteoptions = row != null ? stateChoices(ticketRecord(row.id), me) : []hasOptions = options.length > 0memberOptions = row != null ? assignChoices(row.projectId) : []// the comments (mission 016): the user the blocks compare authors with ('' = read only) and the history as entriesmeName = me != null ? me.name : ''meId = me != null ? me.id : ''writer = canWrite ? meName : ''entries = entriesOf(events, meId, canWrite)noComments = []newState = options.length > 0 ? options[0].value : ''stateNote = ''// the MdEditor is built once per element: a new key (noteSeq) gives the next note an empty editornoteSeq = 0noteForms = [{ id = 'note-0' }]message = ''// editing (ticket #8): only the author (the server decides; the face checks again)canEdit = row != null && mayEditId(row.id, me)assignDraft = row != null ? row.assigneeId : ''assignMessage = ''editing = falseshowEdit = canEditshowEdit2 = canEditeditSubject = ''editSummary = ''editStart = ''editMessage = ''// relations (ticket #4): the view of lib/tickets-helpers.hl relationViewOf, flat members for the Viewrel = row != null ? relationViewOf(row) : nullhasRelations = rel != null && rel.hasRelationshasParent = rel != null && rel.hasParentparentRef = rel != null ? rel.parent : noRefhasChildren = rel != null && rel.hasChildrenchildren = rel != null ? rel.children : []childNote = rel != null ? rel.childNote : ''childClass = rel != null ? rel.childClass : ''hasBlockedBy = rel != null && rel.hasBlockedByblockedBy = rel != null ? rel.blockedBy : []hasBlocks = rel != null && rel.hasBlocksblocks = rel != null ? rel.blocks : []parentDraft = ''blockerDraft = ''linkMessage = ''View {ticketView {if (gone) { p { id = "gone" class = "empty" "There is no such ticket." } }if (present) {header {p { a { id = "project" href = projectHref project } " " ticketRef { id = "ref" ref }if (hasOld) { formerRef { id = "oldref" "formerly " oldRef } }}h1 { id = "subject" subject }ticketState { id = "state" class = stateSlug state }p { class = "people" "opened by " strong { id = "createdby" createdBy }if (hasAssignee) { " · assigned to " strong { id = "assignee" assignee } }}if (movedNote) { p { id = "movednote" class = "hint" "This project has a new address: " a { id = "movedlink" href = currentHref currentHref } } }p { class = "dates" "opened " time { created } " · updated " time { id = "updated" updated } }if (showEdit) { button { id = "editbutton" type = "button" class = "quiet" "Edit" on click(e) { emit startEdit(e) } } }}if (editing) {form { id = "editform"on submit(e) {e.preventDefault()emit saveEdit(e)}label { "Subject"input { id = "editsubject" name = "subject" required = "required" maxlength = "200" value = editSubject on input(e) { emit setEditSubject(e.target.value) } }}mdField { id = "editsummary" on input(e) { emit setEditSummary(e.target.name, e.target.value) }span { "Summary" }MdEditor { name = "summary" value = editStart rows = 8 files = "off" }}formButtons {button { id = "editsave" type = "submit" "Save" }button { id = "editcancel" type = "button" class = "quiet" "Cancel" on click(e) { emit cancelEdit(e) } }}p { id = "editmessage" class = "message" editMessage }}}if (hasSummary) { ticketSummary { id = "summary" Markdown { blocks = summaryMd } } }if (hasRelations) { ticketRelations { id = "relations"if (hasParent) { p { id = "parent" "Part of "a { href = parentRef.href parentRef.project " " parentRef.ref }" " span { class = "refsubject" parentRef.subject }" " ticketState { class = parentRef.stateSlug parentRef.state }} }if (hasChildren) { div { id = "childrenbox"h2 { "Children" }p { id = "childnote" class = childClass childNote }ul { id = "children" class = "refs"for (c of children) { li {ticketState { class = c.stateSlug c.state }a { href = c.href c.project " " c.ref }span { class = "refsubject" c.subject }} }}} }if (hasBlockedBy) { div { id = "blockedbybox"h2 { "Blocked by" }ul { id = "blockedby" class = "refs"for (c of blockedBy) { li {ticketState { class = c.stateSlug c.state }a { href = c.href c.project " " c.ref }span { class = "refsubject" c.subject }if (showEdit2) { button { type = "button" class = "quiet unblock" value = c.key "Remove" on click(e) { emit removeBlocker(e.target.value) } } }} }}} }if (hasBlocks) { div { id = "blocksbox"h2 { "Blocks" }ul { id = "blocks" class = "refs"for (c of blocks) { li {ticketState { class = c.stateSlug c.state }a { href = c.href c.project " " c.ref }span { class = "refsubject" c.subject }} }}} }} }section {h2 { "History" }ol { id = "events"for (en of entries) {if (en.isGroup) { li { class = "comments"Comments { comments = en.comments user = writer onPost = posted onEdit = edited onDelete = deleted onLike = liked }} }if (en.isEvent) { li { class = en.clseventHead {strong { en.ev.author }" " en.ev.labelif (en.ev.isState) { " " ticketState { class = en.ev.toSlug en.ev.to } }" " time { en.ev.when }}if (en.ev.isEdit) { eventText { class = "edit"if (en.ev.subjectChanged) { p { class = "was" "Subject before: " s { en.ev.oldSubject } } }if (en.ev.summaryChanged) { details { class = "was"summary { "Summary before" }Markdown { blocks = en.ev.oldSummaryMd }} }} }if (en.ev.hasText) { eventText { Markdown { blocks = en.ev.md } } }} }}}}if (mustLogIn) {p { id = "loginhint" class = "hint" "Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name." }}if (notMember) {p { id = "memberhint" class = "hint" "You are not a member of this project — ask an admin to invite you to comment." }}if (canWrite) { section {h2 { "Respond" }commentForm { id = "commentform"Comments { comments = noComments user = writer onPost = posted emptyText = "" placeholder = "Write a comment (Markdown; Ctrl+Enter sends)" attach = "true" maxFileSize = 10485760 attachText = "Add pictures or files: drop or paste them here, or" }}if (hasOptions) { form { id = "stateform"on submit(e) {e.preventDefault()emit sendState(e)}label { "State"select { id = "newstate" name = "state" value = newStateon change(e) { emit setNewState(e.target.value) }for (o of options) { option { value = o.value o.label } }}}mdField { id = "statenote" on input(e) { emit setStateNote(e.target.name, e.target.value) }span { "Note (optional)" }for (f of noteForms) { MdEditor { name = "note" value = "" rows = 1 placeholder = "" files = "off" } }}button { id = "statesend" type = "submit" "Change state" }} }p { id = "message" class = "message" message }} }if (showEdit2) { section {h2 { "Manage" }form { id = "assignform"on submit(e) {e.preventDefault()emit sendAssign(e)}label { "Assigned to"select { id = "assignselect" name = "assignee" value = assignDraft on change(e) { emit setAssignDraft(e.target.value) }option { value = "" "nobody" }for (o of memberOptions) { option { value = o.value o.label } }}}button { id = "assignsave" type = "submit" "Assign" }}p { id = "assignmessage" class = "message" assignMessage }form { id = "parentform"on submit(e) {e.preventDefault()emit sendParent(e)}label { "Parent ticket (project#number)"input { id = "parentkey" name = "parent" placeholder = "e.g. ident.worldapi.org#1" autocomplete = "off" value = parentDraft on input(e) { emit setParentDraft(e.target.value) } }}formButtons {button { id = "parentsave" type = "submit" "Set parent" }if (hasParent) { button { id = "parentremove" type = "button" class = "quiet" "Remove parent" on click(e) { emit removeParent(e) } } }}}form { id = "blockerform"on submit(e) {e.preventDefault()emit sendBlocker(e)}label { "Blocked by (project#number)"input { id = "blockerkey" name = "blocker" placeholder = "e.g. hybriel#12" autocomplete = "off" value = blockerDraft on input(e) { emit setBlockerDraft(e.target.value) } }}button { id = "blockeradd" type = "submit" "Add blocker" }}p { id = "linkmessage" class = "message" linkMessage }} }}}}on setEditSubject(v) { editSubject = v }// the MdEditor announces its Markdown with an `input` event on its hidden field (named); its other inputs are not iton setEditSummary(name, v) { if (name == 'summary') { editSummary = v } }on startEdit(e) {editSubject = subjecteditSummary = summaryeditStart = summaryeditMessage = ''editing = trueshowEdit = false}on cancelEdit(e) {editing = falseshowEdit = canEditeditMessage = ''}on saveEdit(e) {r = emit server ticketEdit(ticketId, editSubject, editSummary)if (r != null && r.error != null) {editMessage = r.errorreturn null}editing = falseshowEdit = canEditeditMessage = ''}on setNewState(v) { newState = v }on setAssignDraft(v) { assignDraft = v }on sendAssign(e) {r = emit server ticketAssign(ticketId, assignDraft)if (r != null && r.error != null) { assignMessage = r.error } else { assignMessage = '' }}on setParentDraft(v) { parentDraft = v }on setBlockerDraft(v) { blockerDraft = v }// relations (ticket #4): the answer is only ok / error — the page follows the pushon sendParent(e) {if (parentDraft.trim() == '') {linkMessage = 'name the parent as project#number'return null}r = emit server ticketSetParent(ticketId, parentDraft)if (r != null && r.error != null) { linkMessage = r.error } else { linkMessage = '' parentDraft = '' }}on removeParent(e) {r = emit server ticketSetParent(ticketId, '')if (r != null && r.error != null) { linkMessage = r.error } else { linkMessage = '' }}on sendBlocker(e) {if (blockerDraft.trim() == '') {linkMessage = 'name the blocking ticket as project#number'return null}r = emit server ticketAddBlocker(ticketId, blockerDraft)if (r != null && r.error != null) { linkMessage = r.error } else { linkMessage = '' blockerDraft = '' }}on removeBlocker(key) {r = emit server ticketRemoveBlocker(ticketId, key)if (r != null && r.error != null) { linkMessage = r.error } else { linkMessage = '' }}on setStateNote(name, v) { if (name == 'note') { stateNote = v } }on sendState(e) {r = emit server setTicketState(ticketId, newState, stateNote)if (r != null && r.error != null) {message = r.errorreturn null}message = ''stateNote = ''noteSeq = noteSeq + 1noteForms = [{ id = 'note-' + noteSeq }]}// ---- the comments (mission 016): the history as entries — a run of comments is one block, every other event one line.// A comment entry is the block's record { id, author, when, text, likes, liked, history, files }; a deleted comment is a line.// `see` (tickets#27): may the user looking fetch the attachments (a member)? If not, the files come without url.entriesOf(list, uid, see) {out = []let run = []for (ev of list) {if (ev.kind == 'comment' && ev.deleted != true) {run.push({ id = '' + ev.id author = ev.author when = ev.when text = ev.text likes = ev.likes != null ? ev.likes : 0 liked = uid != '' && ev.likedBy != null && ev.likedBy.includes(uid) history = ev.earlier != null ? ev.earlier : [] files = filesOf(ev.attachments, see) })} else {if (run.length > 0) {out.push({ id = 'c-' + run[0].id isGroup = true isEvent = false comments = run cls = 'comments' ev = {} })run = []}out.push({ id = '' + ev.id isGroup = false isEvent = true comments = [] cls = ev.deleted == true ? 'comment deleted' : ev.kind ev = ev })}}if (run.length > 0) { out.push({ id = 'c-' + run[0].id isGroup = true isEvent = false comments = run cls = 'comments' ev = {} }) }return out}// a comment's attachments as the block shows them: { name, url ('' = may not fetch), image, size }filesOf(list, see) {out = []if (list == null) { return out }for (a of list) { out.push({ name = a.name url = see == true ? a.url : '' image = a.image size = a.size }) }return out}// what the blocks tell this page: the faces write; every open page (this one too) follows the push. A refusal shows in// #message; a refused post answers false, so the block keeps the typed text (and the files). With files (tickets#27) the post is// the face commentWithFiles: the framework uploads them first; a file it refuses (over uploadMax) ends the emit with null.posted = (text, files) => {let r = nullif (files != null && files.length > 0) {r = emit server commentWithFiles(ticketId, text, files)if (r == null) {message = 'the comment was not sent: a file could not be uploaded (at most 10 MB each)'return false}} else {r = emit server commentOn(ticketId, text)}if (r != null && r.error != null) {message = r.errorreturn false}message = ''return true}edited = (id, text) => {r = emit server ticketCommentEdit(ticketId, id, text)message = r != null && r.error != null ? r.error : ''}deleted = (id) => {r = emit server ticketCommentDelete(ticketId, id)message = r != null && r.error != null ? r.error : ''}liked = (id) => {r = emit server ticketCommentLike(ticketId, id)message = r != null && r.error != null ? r.error : ''}// ---- what the server pushes: an event on some ticket -----------------------------------on client ticketEvent(evTicket, ev, changed, count) {if ('' + evTicket == '' + ticketId) {next = []for (x of events) { next.push(x) }next.push(ev)events = nextentries = entriesOf(next, meId, canWrite)state = changed.statestateSlug = changed.stateSlugupdated = changed.updatedassignee = changed.assigneehasAssignee = changed.hasAssigneeassignDraft = changed.assigneeIdrights = emit server ticketRights(ticketId)takeRights(rights)if (ev.isEdit == true) {subject = changed.subjectsummary = changed.summaryhasSummary = changed.summary != ''summaryMd = ev.summaryMd}}}// mission 016: a comment of THIS ticket was edited, deleted or (un)liked — its row is swappedon client commentChanged(evTicket, ev) {if ('' + evTicket == '' + ticketId) {next = []for (x of events) {if ('' + x.id == '' + ev.id) { next.push(ev) } else { next.push(x) }}events = nextentries = entriesOf(next, meId, canWrite)}}// relations changed (a write on this ticket or on a related one): take over this ticket's viewon client ticketsRelated(views) {for (v of views) {if ('' + v.id == '' + ticketId) {hasRelations = v.hasRelationshasParent = v.hasParentparentRef = v.parenthasChildren = v.hasChildrenchildren = v.childrenchildNote = v.childNotechildClass = v.childClasshasBlockedBy = v.hasBlockedByblockedBy = v.blockedByhasBlocks = v.hasBlocksblocks = v.blocks}}}// login / logout in the shell (this session's tabs): the forms come and go without a reload// what this session's user may do on this ticket now (the face answers from their role)takeRights = (r) => {if (r == null || r.error != null) { return null }canWrite = r.comment == truemeName = r.namemeId = r.userIdwriter = r.comment == true ? r.name : ''entries = entriesOf(events, r.userId, canWrite)mustLogIn = falsenotMember = !canWritecanEdit = r.edit == trueshowEdit = canEdit && !editingshowEdit2 = canEditoptions = r.optionshasOptions = r.options.length > 0memberOptions = r.membersnewState = r.options.length > 0 ? r.options[0].value : ''}on client signedIn(tag, info) {r = emit server ticketRights(ticketId)takeRights(r)}on client signedOut(tag) {canWrite = falsewriter = ''meName = ''meId = ''entries = entriesOf(events, '', false)mustLogIn = truenotMember = falsecanEdit = falseshowEdit = falseshowEdit2 = falsehasOptions = falseediting = false}// ---- the faces: the writer is the session's user (#31: a forged trailing argument is not// a real session → refused) ---------------------------------------------------------------on server commentOn(ticketId, text, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }r = addComment('' + ticketId, w.user, text, null)if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)return { ok = true }}// tickets#27: a comment with files — `files` arrive as [{ bytes, name, type, size }] (the framework took them from /__hl/upload);// lib/attachments.hl checks the limits and the content, a refusal comes back as the messageon server commentWithFiles(ticketId, text, files, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(text) != 'String') { return { error = 'the comment must be text' } }r = addComment('' + ticketId, w.user, text, files)if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)return { ok = true }}on server setTicketState(ticketId, state, note, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }r = changeState('' + ticketId, state, w.user, note)if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)if (r.assignEvent != null) { emit client ticketEvent(r.ticket.id, pageEventOf(r.assignEvent), r.ticket) }emit client ticketsRelated(relatedViews(r.ticket.id, []))return { ok = true }}// mission 016: the comment's author edits / deletes it, a member likes it (again = takes it back) — lib/comments.hl decideson server ticketCommentEdit(ticketId, commentId, text, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(text) != 'String') { return { error = 'the comment must be text' } }r = changeComment('' + ticketId, '' + commentId, w.user, 'edit', text)if (r.error != null) { return { error = r.error } }emit client commentChanged(r.ticket.id, pageEventOf(r.event))return { ok = true }}on server ticketCommentDelete(ticketId, commentId, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }r = changeComment('' + ticketId, '' + commentId, w.user, 'delete', '')if (r.error != null) { return { error = r.error } }emit client commentChanged(r.ticket.id, pageEventOf(r.event))return { ok = true }}on server ticketCommentLike(ticketId, commentId, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }r = changeComment('' + ticketId, '' + commentId, w.user, 'like', '')if (r.error != null) { return { error = r.error } }emit client commentChanged(r.ticket.id, pageEventOf(r.event))return { ok = true }}// ticket #20: assign the ticket to a member ('' = nobody); the store wants the role edit or adminon server ticketAssign(ticketId, userId, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(userId) != 'String') { return { error = 'the assignee must be text' } }r = assignTicket('' + ticketId, w.user, userId)if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)return { ok = true }}// ticket #8: the author edits subject + summary (the store refuses anyone else)on server ticketEdit(ticketId, subject, summary, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(subject) != 'String' || hlTypeName(summary) != 'String') { return { error = 'subject and summary must be text' } }r = editTicket('' + ticketId, w.user, subject, summary)if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)emit client ticketsRelated(relatedViews(r.ticket.id, []))return { ok = true }}// ticket #4: relations — the store refuses a user who may not (author of either ticket / creator)on server ticketSetParent(ticketId, key, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(key) != 'String') { return { error = 'the parent must be text' } }r = setParent('' + ticketId, w.user, key)if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)emit client ticketsRelated(r.related)return { ok = true }}on server ticketAddBlocker(ticketId, key, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(key) != 'String') { return { error = 'the blocker must be text' } }r = changeBlocker('' + ticketId, w.user, key, true, 'add')if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)emit client ticketsRelated(r.related)return { ok = true }}on server ticketRemoveBlocker(ticketId, key, session) {w = writerOfSession(session)if (w.error != null) { return { error = w.error } }if (hlTypeName(key) != 'String') { return { error = 'the blocker must be text' } }r = changeBlocker('' + ticketId, w.user, key, false, 'remove')if (r.error != null) { return { error = r.error } }emit client ticketEvent(r.ticket.id, pageEventOf(r.event), r.ticket)emit client ticketsRelated(r.related)return { ok = true }}// what the session's user may do on this ticket: comment (a member), edit / assign (edit, admin), the states// they may move it to, and the members it can be assigned toon server ticketRights(ticketId, session) {u = userOfSession(session)if (u == null) { return { error = 'log in first' } }t = ticketRecord('' + ticketId)if (t == null) { return { error = 'no such ticket' } }r = ticketRights(t, u)// mission 016: who the comment blocks compare authors with, and whose likes count as "liked"r.name = u.namer.userId = u.idreturn r}
Branches
Latest commits
- ccebb0c7mobile: ticket number stays on one line, filter chips one scrolling row, fields full width under their caption, Edit/action buttons, member names whole, 44 px relation linksmre
- f2dc7741gate: the phone toolbar is two even rows (E2)mre
- 20f7c33async components.hybriel 214c318: MdEditor on a phone, two even toolbar rows of 44 px targets, label 15 px, table head 16 px (E2)mre
- d74a5482sync components.hybriel 134b4e3: MdEditor builds an editor put into the page at once, redraws a surface put in anew (F5, hybriel#211)mre
- 9d02c540sync components.hybriel 6b0936a: the 'edited' foldable drops the theme's border and marginmre
- 22751914sync components.hybriel 8d79ff7: bubble hugs its content, quiet 'edited' label; gate checksmre
- c8452453sync components 9a: shared Icon (icons/icons.hl), md-editor toolbar icons + single focus ring (components f4-icons ba96735)mre
- 52ba11e8sync-components: copy icons/icons.hl + README (F4); testsmre
- 138d198dmd-editor.hl: verbatim copy of components f3-mdvalue (an older text handed back is kept)mre
- 18d2df60md-editor.hl: verbatim copy of components f3-mdvalue (an outside value change is shown by the editor)mre
- f6764bedreports/H1-hydrate.mdmre
- 1bbbf0edtests/browser.mjs: wait for hydration before clicking the login button on / (device B)mre
- 6f503cfctests/cdp.mjs: HL_CPU_THROTTLE=<rate> optional CPU throttling for gate runsmre
- e17e2855re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- a6ddccd2re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- 81e036b7docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 5d8d2cf6deploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- 58e8c02cmission 024: report, LOG, STATUS, e2e fixmre
- 50778073tests/e2e-route-marker.mjs: first paint marker, comments post/edit redrawmre
- c5203298mission 024: MainMenu marks the page from the route (layouts 0bcc629 main-menu.hl); browser-side marker removed; gate: marker in the server HTMLmre