mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: allow to call the commit route with a hash
With this commit, it's not possible to go directly to the commit frontend page with a commit hash with its id or directly with the hash value.
This commit is contained in:
parent
fef9ae9801
commit
929bc33569
@ -234,8 +234,16 @@ class Runbot(Controller):
|
||||
build = slot.sudo()._create_missing_build()
|
||||
return werkzeug.utils.redirect('/runbot/build/%s' % build.id)
|
||||
|
||||
@route(['/runbot/commit/<model("runbot.commit"):commit>'], website=True, auth='public', type='http', sitemap=False)
|
||||
def commit(self, commit=None, **kwargs):
|
||||
@route([
|
||||
'/runbot/commit/<model("runbot.commit"):commit>',
|
||||
'/runbot/commit/<string(minlength=6, maxlength=40):commit_hash>'
|
||||
], website=True, auth='public', type='http', sitemap=False)
|
||||
def commit(self, commit=None, commit_hash=None, **kwargs):
|
||||
if commit_hash:
|
||||
commit = request.env['runbot.commit'].search([('name', '=like', f'{commit_hash}%')], limit=1)
|
||||
if not commit.exists():
|
||||
raise NotFound()
|
||||
return request.redirect(f"/runbot/commit/{slug(commit)}")
|
||||
status_list = request.env['runbot.commit.status'].search([('commit_id', '=', commit.id)], order='id desc')
|
||||
last_status_by_context = dict()
|
||||
for status in status_list:
|
||||
|
Loading…
Reference in New Issue
Block a user