[FIX] runbot_merge: don't show unreceive optional statuses

... by default. Optional statuses we haven't at least received a
`pending` for are irrelevant to the PR's state, so should remain
hidden.

This subtetly was missed when fixing #1062

Fixes #1066
This commit is contained in:
Xavier Morel 2025-02-27 14:14:33 +01:00
parent 50568cfcc6
commit 9d2638e653
2 changed files with 13 additions and 9 deletions

View File

@ -402,15 +402,19 @@ def render_full_table(pr, branches, repos, batches):
if not pr.batch_id.skipchecks: if not pr.batch_id.skipchecks:
statuses = json.loads(pr.statuses_full) statuses = json.loads(pr.statuses_full)
for ci in pr.repository.status_ids._for_pr(pr): for ci in pr.repository.status_ids._for_pr(pr):
st = (statuses.get(ci.context.strip()) or {'state': 'pending'})['state'] if (status := statuses.get(ci.context.strip())) is None:
if ci.prs != 'required':
continue
status = {'state': 'pending'}
color = foreground color = foreground
if st in ('error', 'failure'): match status['state']:
color = error case 'error' | 'failure':
box = boxes[False] color = error
elif st == 'success': box = boxes[False]
box = boxes[True] case 'success':
else: box = boxes[True]
box = boxes[None] case _:
box = boxes[None]
lines.append(Line([ lines.append(Line([
Text(" - ", font, color), Text(" - ", font, color),

View File

@ -409,7 +409,7 @@
<t t-elif="st['state'] in ('error', 'failure')">fail</t> <t t-elif="st['state'] in ('error', 'failure')">fail</t>
<t t-else="">ok</t> <t t-else="">ok</t>
</t> </t>
<li t-att-class="result"> <li t-if="ci.prs == 'required' or st" t-att-class="result">
<a t-att-href="st.get('target_url') if st else None"><t t-esc="ci.context.strip()"/></a><t t-if="st and st.get('description')">: <t t-esc="st['description']"/></t> <a t-att-href="st.get('target_url') if st else None"><t t-esc="ci.context.strip()"/></a><t t-if="st and st.get('description')">: <t t-esc="st['description']"/></t>
</li> </li>
</t> </t>