Merge pull request 'Close issues and continue the Today session' (#392) from timmy/391-close-and-next into main
All checks were successful
CI / lint (push) Successful in 42s
CI / build-release (push) Successful in 5s
CI / release-candidate (push) Successful in 5s

This commit is contained in:
rockachopa 2026-08-09 10:14:29 +00:00
commit 8ada75ec33
2 changed files with 29 additions and 4 deletions

View File

@ -981,7 +981,7 @@
);
}
function refreshMyWorkView() {
function refreshMyWorkView({ reconcileSession = true } = {}) {
lastDrafts = listDrafts();
const partitioned = laterWork.partition(lastMyWork, {
pruneMissing: !Object.values(workPagination).some(page => page?.has_more),
@ -1040,7 +1040,7 @@
'No assigned work, review requests, or unread updates.';
updateWorkPaginationControls();
renderMyWork();
if (workSession.active()) workSession.reconcile();
if (reconcileSession && workSession.active()) workSession.reconcile();
}
function activeWorkStreams() {
@ -1528,6 +1528,7 @@
qs('#issue-edit-form').hidden = true;
qs('#issue-edit-status').textContent = '';
qs('#close-issue').disabled = false;
qs('#close-issue').textContent = workSession.active() ? 'Close & next' : 'Close issue';
qs('#close-issue-sheet').focus();
try {
const detail = offlineDetail || await issueController.load(item);
@ -3139,8 +3140,14 @@
lastMyWork = lastMyWork.filter(item =>
!(item.kind === 'issue' && item.repository === closing.repository && item.number === closing.number)
);
refreshMyWorkView();
qs('#my-work-action-status').textContent = closing.key + ' closed.';
refreshMyWorkView({ reconcileSession:false });
const continuingSession = workSession.active();
if (workSession.active()) workSession.complete();
if (continuingSession && workSession.active()) {
qs('#my-work-action-status').textContent = closing.key + ' closed. Next work item opened.';
} else if (!continuingSession) {
qs('#my-work-action-status').textContent = closing.key + ' closed.';
}
} catch (error) {
qs('#issue-sheet-status').textContent = error.message + ' The issue remains in My Work; retry.';
button.disabled = false;

View File

@ -1376,6 +1376,24 @@ async def test_dashboard_wires_work_session_to_existing_sheet_flows_and_completi
assert opener in html
@pytest.mark.anyio
async def test_closing_issue_advances_active_session_once_and_exposes_close_and_next():
html = await dashboard()
assert "qs('#close-issue').textContent = workSession.active() ? 'Close & next' : 'Close issue';" in html
close_handler = html.split("qs('#close-issue').addEventListener('click'", 1)[1].split(
"qs('#close-pull-sheet').addEventListener", 1
)[0]
assert "refreshMyWorkView({ reconcileSession:false });" in close_handler
assert "if (workSession.active()) workSession.complete();" in close_handler
assert close_handler.index("await issueController.close(selectedIssue)") < close_handler.index(
"if (workSession.active()) workSession.complete();"
)
assert close_handler.index("lastMyWork = lastMyWork.filter") < close_handler.index(
"if (workSession.active()) workSession.complete();"
)
def test_work_session_can_start_at_a_newly_created_item():
script = f"""
const buildMyWork = require({json.dumps(str(MY_WORK))});