Skip to content

Commit

Permalink
re-implemented parent colors differently
Browse files Browse the repository at this point in the history
  • Loading branch information
J2-Tech committed Nov 19, 2024
1 parent b62f5e7 commit 47c0f5e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/jiraController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ const configController = require('./configController');
const dayjs = require('dayjs');
const path = require('path');

exports.getParentIssueColor = async function(req, issue) {
exports.getParentIssueColor = async function(settings, req, issue) {
if (issue.fields.parent) {
const parentIssue = await jiraAPIController.getIssue(req, issue.fields.parent.id);
if (parentIssue && parentIssue.fields) {
const color = await exports.getParentIssueColor(req, parentIssue);
const color = await exports.getParentIssueColor(settings, req, parentIssue);
if (color) {
return color;
}
if (settings.issueColors[parentIssue.key.toLowerCase()]) {
return settings.issueColors[parentIssue.key.toLowerCase()];
}
if (parentIssue.fields[configController.loadConfig().issueColorField]) {
const jiraColor = parentIssue.fields[configController.loadConfig().issueColorField];
switch (jiraColor) {
Expand Down Expand Up @@ -44,7 +47,7 @@ exports.determineIssueColor = async function(req, issue) {
if (!color) {
// get the issue details
const issueDetails = await jiraAPIController.getIssue(req, issue.issueId);
color = await exports.getParentIssueColor(req, issueDetails);
color = await exports.getParentIssueColor(settings, req, issueDetails);
if (!color && issue.issueType) {
const issueTypeLower = issue.issueType.toLowerCase();
color = settings.issueColors[issueTypeLower] || defaultColor;
Expand Down

0 comments on commit 47c0f5e

Please sign in to comment.