Issue 354 Workspace Links Missed Tasks - edmozley/freeitsm GitHub Wiki
GitHub #354, reported by pappas81 ยท Tickets ยท since the ticket workspace, fixed in 5.4.0 (#2951)
A ticket had three linked tasks: one Jira issue and two tasks from the taskboard. In the normal reading pane, the Links strip showed all three. In workspace mode, the Links tab showed only the Jira issue, so the ticket looked as though it had no tasks.
The tasks were there, but on a different tab. When the workspace arrived (PR #212), a task could be opened in place, beside the ticket, from the Work tab. To get there, task pills were drawn in the Work tab instead of the Links strip:
// assets/js/inbox.js, buildLinksSection() - before
${workspace ? '' : '<span class="strip-pill-group" id="stripTaskPills"></span>'}
// loadTicketTasks() / renderTicketTasks() - before: ONE place, whichever exists
const host = document.getElementById('twTaskList') || document.getElementById('stripTaskPills');In the reading pane, twTaskList does not exist, so the pills went to the strip. In the workspace, the strip's holder was never drawn, so the pills went only to the Work tab. Jira issues, problems, changes, equipment and every other kind of link stayed in Links. Only tasks moved.
Was it more than one place? No. I checked every holder in the strip (equipment, CMDB, domains, projects), and the workspace draws them all. Tasks were the only kind left out.
A task is a link, so it now shows in both places. One small function says where task pills go, and the same pills are drawn in each:
function taskPillHosts() {
return ['twTaskList', 'stripTaskPills'].map(id => document.getElementById(id)).filter(Boolean);
}
// renderTicketTasks():
hosts.forEach(host => { host.innerHTML = html; });Clicking a task in the workspace still opens it in the Work tab, from either place, because the click handler was already written that way. A TRAP: comment on taskPillHosts() records why tasks must stay in Links.
tests/ticket-workspace.php covers the workspace layout, and it had been failing for some time with Cannot access 'liveTicketId' before initialization. That message did not point at the real problem. inbox.js now needs schedule.js, which the real Tickets page loads first. The test page did not load it, so inbox.js stopped part-way through loading, and a later let was never set up. The test page now loads schedule.js as the real page does.
| File | Change |
|---|---|
assets/js/inbox.js |
Task pill holder always in the Links strip; taskPillHosts(); pills drawn in every holder |
tickets/index.php |
inbox.js?v=209 |
tests/support/ticket-workspace-page.php |
Loads schedule.js before inbox.js |
tests/ticket-workspace.php |
Two checks: a linked task in the Links tab, and still in the Work tab |
tests/ticket-workspace.php renders a real ticket in the workspace with a linked task. The task now shows in both the Links tab and the Work tab, and all 56 checks pass. Control: with the old inbox.js, the Links tab check fails, which is the bug as reported. tests/links-strip.php (19 checks) also still passes.
Update to 5.4.0. The Links tab then lists a ticket's tasks again, as the reading pane always has.
Related: Ticket workspace ยท Tasks