[FIX] runbot_merge: stagings dashboard

Mistake in the statuses handling: the context is not sufficient to
uniquely identify a staging status as different repositories can get
the same status context (e.g. ci/runbot is present on all our
repositories).

This is only a visual problem, but the status dropdown on
stagings (both the dashboard and the branchwise listing) would reuse
one of the status with the context for all of them, leading to
incorrect links and misleading displays.

Fix by keying on (repo, context) instead, that's exactly why the
repository name was part of the status in the first place.
This commit is contained in:
Xavier Morel 2020-07-29 08:42:56 +02:00
parent 36026f46e4
commit b8408546a0

View File

@ -159,9 +159,9 @@
</a>
</li>
<t t-set="statuses" t-value="{c: (s, t) for h, c, s, t in staging.statuses}"/>
<t t-set="statuses" t-value="{(r, c): (s, t) for r, c, s, t in staging.statuses}"/>
<t t-foreach="repo_statuses._for_staging(staging)" t-as="req">
<t t-set="st" t-value="statuses.get(req.context) or ('pending', None)"/>
<t t-set="st" t-value="statuses.get((req.repo_id.name, req.context)) or ('pending', None)"/>
<li t-att-class="
'bg-success' if st[0] == 'success'
else 'bg-danger' if st[0] in ('error', 'failure')
@ -237,10 +237,9 @@
Open Staging
</a>
</li>
<t t-set="statuses" t-value="{c: (s, t) for h, c, s, t in staging.statuses}"/>
<t t-set="statuses" t-value="{(r, c): (s, t) for r, c, s, t in staging.statuses}"/>
<t t-foreach="repo_statuses._for_staging(staging)" t-as="req">
<t t-set="st" t-value="statuses.get(req.context) or ('pending', None)"/>
<t t-set="st" t-value="statuses.get((req.repo_id.name, req.context)) or ('pending', None)"/>
<li t-att-class="
'bg-success' if st[0] == 'success'
else 'bg-danger' if st[0] in ('error', 'failure')