[IMP] forwardport: show a user's outstanding tally in the main alert

Previously the alert would show the total number of outstanding
forward ports, which most people don't care about (if they're even
logged which probably isn't the case), so that was mostly useful
for... me.

Add the current user's tally to the message as well. If the user is
logged. Which is always, because the alert only shows up if the user
has read access to PRs.

Fixes #801
This commit is contained in:
Xavier Morel 2025-01-24 15:54:58 +01:00
parent 63a4916d00
commit 896624674f

View File

@ -15,9 +15,19 @@
('state', 'in', ['opened', 'validated', 'approved', 'ready', 'error']),
('create_date', '<', datetime.datetime.now() - relativedelta(days=7)),
])"/>
<t t-set="own" t-value="env['runbot_merge.pull_requests'].search_count([
('source_id', '!=', False),
('blocked', '!=', False),
('state', 'in', ['opened', 'validated', 'approved', 'ready', 'error']),
('create_date', '&lt;', datetime.datetime.now() - relativedelta(days=7)),
'|',
('source_id.author', '=', env.user.partner_id.id),
('source_id.reviewed_by', '=', env.user.partner_id.id),
])"/>
<div t-if="outstanding != 0" class="alert col-md-12 alert-warning mb-0">
<a href="/forwardport/outstanding">
<t t-out="outstanding"/> outstanding forward-ports (>1 week)
You have <t t-out="own"/> outstanding forward-ports
out of <t t-out="outstanding"/> total
</a>
</div>
</t>