userscript/origin: update release request handling.

This commit is contained in:
Jimmy Berry 2019-08-16 14:46:05 -05:00
parent 249a35efe6
commit 45d065b027

View File

@ -43,25 +43,22 @@ function request_actions_handle() {
// Select the text represtation of action. All other sources are // Select the text represtation of action. All other sources are
// inconsistent and do not always have the right values depending on // inconsistent and do not always have the right values depending on
// request type or state. // request type or state. Still suffers from shortening with ellipses.
var summary = document.evaluate( var summary = document.evaluate(
'div[1]/div[1]', 'div[1]/div[1]',
action, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; action, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var parts = $(summary).text().trim().split(' '); var parts = $(summary).text().trim().split(' ');
// Maintenance incidents are so special. var request_type = parts[0].toLowerCase();
var release_project = document.evaluate(
'i[1]', parts = parts.splice(-3);
action, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; var project = parts[0];
var project, package; var package = parts[2];
if (release_project) {
parts = parts.splice(4, 3); if (request_type == 'release') {
project = $(release_project).text().trim().split(' ').splice(-1)[0]; // Maintenance release requests special (strip target package incident suffix).
} else { package = package.split('.').slice(0, -1).join('.');
parts = parts.splice(-3);
project = parts[0];
} }
package = parts[2];
var card = document.createElement('div'); var card = document.createElement('div');
card.classList.add('card'); card.classList.add('card');