Make mobile Queues census include Following and My PRs (#1453)
Closes #1452
This commit is contained in:
commit
7a09452bef
|
|
@ -123,12 +123,14 @@
|
|||
queueCounts.followingUnavailable = false;
|
||||
preparationItems.following = items.filter(item => item.has_unseen_change === true);
|
||||
renderMobileQueuePresentation();
|
||||
mobileTaskDock.updateQueues(queueCounts);
|
||||
mobileStartDay.render();
|
||||
},
|
||||
onStatus:status => {
|
||||
if (status === 'loading') return;
|
||||
queueCounts.followingUnavailable = status === 'error';
|
||||
renderMobileQueuePresentation();
|
||||
mobileTaskDock.updateQueues(queueCounts);
|
||||
mobileStartDay.render();
|
||||
},
|
||||
onReviewComplete:() => mobileStartDay.completePhase('following'),
|
||||
|
|
@ -3547,9 +3549,12 @@
|
|||
counts.delivery = draftInbox.partition(lastDrafts).actionable;
|
||||
counts.gate = queueCounts.gate;
|
||||
counts.gateUnavailable = queueCounts.gateUnavailable;
|
||||
counts.following = queueCounts.following;
|
||||
counts.followingUnavailable = queueCounts.followingUnavailable;
|
||||
preparationItems = {
|
||||
delivery:draftInbox.partition(lastDrafts).deliveries,
|
||||
gate:preparationItems.gate || [],
|
||||
following:preparationItems.following || [],
|
||||
agenda:agendaMyWork(activeMyWork),
|
||||
attention:activeMyWork.filter(item => item.needs_attention),
|
||||
update:activeMyWork.filter(item => item.has_update),
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@
|
|||
}
|
||||
|
||||
function updateQueues(counts) {
|
||||
const names = 'today agenda delivery gate attention update filed later draft'.split(' ');
|
||||
const names = 'today agenda delivery gate attention update following filed authored later draft'.split(' ');
|
||||
const normalized = Object.fromEntries(names.map(name => [name, Math.max(0, Number(counts?.[name]) || 0)]));
|
||||
const actionableNames = ['today', 'delivery', 'gate', 'attention', 'update', 'filed', 'later', 'draft'];
|
||||
const actionableNames = ['today', 'delivery', 'gate', 'attention', 'update', 'following', 'filed', 'authored', 'later', 'draft'];
|
||||
const active = actionableNames.reduce((total, name) => total + (normalized[name] > 0 ? 1 : 0), 0);
|
||||
Object.entries(options.queueCounts || {}).forEach(([name, element]) => {
|
||||
element.textContent = String(normalized[name] || 0);
|
||||
|
|
@ -107,6 +107,9 @@
|
|||
options.queueRows?.update?.setAttribute(
|
||||
'aria-label', 'Updates, ' + normalized.update + ' unread conversations'
|
||||
);
|
||||
options.queueRows?.following?.setAttribute(
|
||||
'aria-label', 'Following, ' + normalized.following + ' unseen changes'
|
||||
);
|
||||
if (options.queueBadge) {
|
||||
options.queueBadge.textContent = active + ' active';
|
||||
options.queueBadge.hidden = active === 0;
|
||||
|
|
@ -127,7 +130,9 @@
|
|||
+ ', Human Gates ' + normalized.gate
|
||||
+ ', Attention ' + normalized.attention
|
||||
+ ', Updates ' + normalized.update
|
||||
+ ', Following ' + normalized.following
|
||||
+ ', Filed ' + normalized.filed
|
||||
+ ', My PRs ' + normalized.authored
|
||||
+ ', Later ' + normalized.later
|
||||
+ ', Drafts ' + normalized.draft
|
||||
+ '; ' + active + ' active ' + (active === 1 ? 'queue' : 'queues');
|
||||
|
|
|
|||
|
|
@ -300,6 +300,33 @@ async def test_mobile_queue_sheet_prioritizes_next_active_and_planning_without_d
|
|||
assert html.count(f'<button data-mobile-queue="{name}"') == 1
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_following_hydration_refreshes_the_persistent_mobile_queue_census():
|
||||
html = await dashboard()
|
||||
|
||||
assert (
|
||||
"preparationItems.following = items.filter(item => item.has_unseen_change === true);\n"
|
||||
" renderMobileQueuePresentation();\n"
|
||||
" mobileTaskDock.updateQueues(queueCounts);\n"
|
||||
" mobileStartDay.render();"
|
||||
) in html
|
||||
assert (
|
||||
"queueCounts.followingUnavailable = status === 'error';\n"
|
||||
" renderMobileQueuePresentation();\n"
|
||||
" mobileTaskDock.updateQueues(queueCounts);\n"
|
||||
" mobileStartDay.render();"
|
||||
) in html
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_my_work_refresh_preserves_the_hydrated_following_queue():
|
||||
html = await dashboard()
|
||||
|
||||
assert "counts.following = queueCounts.following;" in html
|
||||
assert "counts.followingUnavailable = queueCounts.followingUnavailable;" in html
|
||||
assert "following:preparationItems.following || []," in html
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_find_and_queue_detours_are_visible_and_wired_to_today_timing():
|
||||
html = await dashboard()
|
||||
|
|
@ -548,7 +575,7 @@ process.stdout.write(JSON.stringify({{
|
|||
"populated": {
|
||||
"badge": "8 active",
|
||||
"badgeHidden": False,
|
||||
"badgeLabel": "Queues: Today 2, Agenda 5 due, Delivery 1, Human Gates 2, Attention 1, Updates 5, Filed 2, Later 3, Drafts 4; 8 active queues",
|
||||
"badgeLabel": "Queues: Today 2, Agenda 5 due, Delivery 1, Human Gates 2, Attention 1, Updates 5, Following 0, Filed 2, My PRs 0, Later 3, Drafts 4; 8 active queues",
|
||||
"deadline": "5 due",
|
||||
"deadlineHidden": False,
|
||||
"agendaDue": "true",
|
||||
|
|
@ -557,7 +584,7 @@ process.stdout.write(JSON.stringify({{
|
|||
"badge": "1 active",
|
||||
"badgeHidden": False,
|
||||
"deadlineHidden": True,
|
||||
"badgeLabel": "Queues: Today 0, Agenda 0 due, Delivery 0, Human Gates 0, Attention 0, Updates 7, Filed 0, Later 0, Drafts 0; 1 active queue",
|
||||
"badgeLabel": "Queues: Today 0, Agenda 0 due, Delivery 0, Human Gates 0, Attention 0, Updates 7, Following 0, Filed 0, My PRs 0, Later 0, Drafts 0; 1 active queue",
|
||||
},
|
||||
"clearedBadgeHidden": True,
|
||||
"clearedDeadlineHidden": True,
|
||||
|
|
@ -570,6 +597,59 @@ process.stdout.write(JSON.stringify({{
|
|||
}
|
||||
|
||||
|
||||
def test_mobile_task_dock_counts_following_and_authored_work_truthfully():
|
||||
script = f"""
|
||||
const createDock = require({json.dumps(str(DOCK))});
|
||||
const node = () => ({{
|
||||
textContent:'', hidden:false, attributes:{{}},
|
||||
setAttribute(name, value) {{ this.attributes[name] = value; }},
|
||||
removeAttribute(name) {{ delete this.attributes[name]; }},
|
||||
}});
|
||||
const queues = node();
|
||||
const badge = node();
|
||||
const deadline = node();
|
||||
const following = node();
|
||||
const authored = node();
|
||||
const dock = createDock({{
|
||||
nav:node(), buttons:{{queues}}, queueBadge:badge, deadlineBadge:deadline,
|
||||
queueRows:{{following, authored}},
|
||||
queueCounts:{{following:node(), authored:node()}},
|
||||
}});
|
||||
dock.updateQueues({{following:3, authored:2}});
|
||||
const active = {{
|
||||
badge:badge.textContent,
|
||||
badgeHidden:badge.hidden,
|
||||
summary:queues.attributes['aria-label'],
|
||||
followingCount:dock ? following.attributes['aria-label'] : null,
|
||||
}};
|
||||
dock.updateQueues({{following:0, authored:0}});
|
||||
process.stdout.write(JSON.stringify({{
|
||||
active,
|
||||
cleared:{{
|
||||
badgeHidden:badge.hidden,
|
||||
summary:queues.attributes['aria-label'],
|
||||
followingLabel:following.attributes['aria-label'],
|
||||
}},
|
||||
}}));
|
||||
"""
|
||||
result = subprocess.run(["node", "-e", script], capture_output=True, text=True)
|
||||
|
||||
assert result.returncode == 0, result.stderr
|
||||
assert json.loads(result.stdout) == {
|
||||
"active": {
|
||||
"badge": "2 active",
|
||||
"badgeHidden": False,
|
||||
"summary": "Queues: Today 0, Agenda 0 due, Delivery 0, Human Gates 0, Attention 0, Updates 0, Following 3, Filed 0, My PRs 2, Later 0, Drafts 0; 2 active queues",
|
||||
"followingCount": "Following, 3 unseen changes",
|
||||
},
|
||||
"cleared": {
|
||||
"badgeHidden": True,
|
||||
"summary": "Queues: no active queues; no upcoming deadlines",
|
||||
"followingLabel": "Following, 0 unseen changes",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_mobile_queue_launcher_opens_first_actionable_item_after_selecting_queue():
|
||||
script = f"""
|
||||
const createLauncher = require({json.dumps(str(QUEUE_LAUNCHER))});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user