Skip to content

Commit

Permalink
EPMRPP-94958 || Jira Cloud plugin. Error on Post issue (#4004)
Browse files Browse the repository at this point in the history
* Update CODEOWNERS

* EPMRPP-94958 || Jira Cloud plugin. Error on Post issue

* EPMRPP-94958 || code review fix -1

---------

Co-authored-by: Ilya <[email protected]>
maria-hambardzumian and AmsterGet authored Sep 6, 2024
1 parent 01f200f commit dc5cfca
Showing 4 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @AmsterGet @Vadim73i @BlazarQSO @maria-hambardzumian
* @AmsterGet @BlazarQSO @maria-hambardzumian
Original file line number Diff line number Diff line change
@@ -17,15 +17,9 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames/bind';
import { JIRA_CLOUD } from 'pages/inside/projectSettingsPageContainer/content/integrations/integrationsList/integrationInfo/constats';
import { dynamicFieldShape } from './dynamicFieldShape';
import { getFieldComponent } from './utils';
import {
ASSIGNEE_FIELD_NAME,
MULTIPLE_AUTOCOMPLETE_TYPE,
VALUE_ID_KEY,
VALUE_NAME_KEY,
} from './constants';
import { getFieldComponent, isJiraCloudAssigneeField } from './utils';
import { AUTOCOMPLETE_TYPE, VALUE_ID_KEY, VALUE_NAME_KEY } from './constants';
import styles from './dynamicFieldsSection.scss';

const cx = classNames.bind(styles);
@@ -70,12 +64,11 @@ export class DynamicFieldsSection extends Component {
} = this.props;

return fields.map((field) => {
const isJiraCloud = integrationInfo.pluginName === JIRA_CLOUD;
const isAssigneeField = field.fieldName?.toLowerCase() === ASSIGNEE_FIELD_NAME.toLowerCase();
const fieldType =
isJiraCloud && isAssigneeField ? MULTIPLE_AUTOCOMPLETE_TYPE : field.fieldType;

const FieldComponent = getFieldComponent({ ...field, fieldType });
const { pluginName } = integrationInfo;
const FieldComponent = getFieldComponent({
...field,
...(isJiraCloudAssigneeField(pluginName, field) && { fieldType: AUTOCOMPLETE_TYPE }),
});

return (
<FieldComponent
8 changes: 8 additions & 0 deletions app/src/components/fields/dynamicFieldsSection/utils.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
*/

import { omit } from 'common/utils/omit';
import { JIRA_CLOUD } from 'pages/inside/projectSettingsPageContainer/content/integrations/integrationsList/integrationInfo/constats';
import {
ARRAY_TYPE,
DROPDOWN_TYPE,
@@ -27,6 +28,7 @@ import {
CREATABLE_MULTIPLE_AUTOCOMPLETE_TYPE,
MULTILINE_TEXT_TYPE,
VALUE_NONE,
ASSIGNEE_FIELD_NAME,
} from './constants';
import { FIELDS_MAP } from './dynamicFieldMap';

@@ -106,3 +108,9 @@ export const removeNoneValues = (inputObj) => {
});
return obj;
};

export const isJiraCloudAssigneeField = (pluginName, field) => {
const isJiraCloud = pluginName === JIRA_CLOUD;
const isAssigneeField = field.fieldName?.toLowerCase() === ASSIGNEE_FIELD_NAME.toLowerCase();
return isJiraCloud && isAssigneeField;
};
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ import {
normalizeFieldsWithOptions,
mapFieldsToValues,
removeNoneValues,
isJiraCloudAssigneeField,
} from 'components/fields/dynamicFieldsSection/utils';
import { projectInfoSelector } from 'controllers/project';
import { FieldProvider } from 'components/fields/fieldProvider';
@@ -279,7 +280,7 @@ export class PostIssueModal extends Component {
getBtsIntegrationBackLink,
data: { items },
} = this.props;

const pluginName = this.state.pluginName;
const fields = this.state.fields.map((field) => {
const isAutocomplete =
field.fieldType === AUTOCOMPLETE_TYPE ||
@@ -290,7 +291,13 @@ export class PostIssueModal extends Component {
if (!Array.isArray(formFieldData)) {
preparedFormFieldData = formFieldData ? [formFieldData] : [];
}
return { ...field, [isAutocomplete ? 'namedValue' : 'value']: preparedFormFieldData };
return {
...field,
[isAutocomplete ? 'namedValue' : 'value']: preparedFormFieldData,
...(isJiraCloudAssigneeField(pluginName, field) && {
value: preparedFormFieldData.map((item) => item.id),
}),
};
});
const backLinks = items.reduce(
(acc, item) => ({ ...acc, [item.id]: getBtsIntegrationBackLink(item) }),

0 comments on commit dc5cfca

Please sign in to comment.