diff --git a/plugin.json b/plugin.json index d1c89eef3..b4a91d5dc 100644 --- a/plugin.json +++ b/plugin.json @@ -4,9 +4,9 @@ "description": "Atlassian Jira plugin for Mattermost.", "homepage_url": "https://github.com/mattermost/mattermost-plugin-jira", "support_url": "https://github.com/mattermost/mattermost-plugin-jira/issues", - "release_notes_url": "https://github.com/mattermost/mattermost-plugin-jira/releases/tag/v3.2.0", + "release_notes_url": "https://github.com/mattermost/mattermost-plugin-jira/releases/tag/v3.2.1", "icon_path": "assets/icon.svg", - "version": "3.2.0", + "version": "3.2.1", "min_server_version": "6.5.0", "server": { "executables": { diff --git a/server/issue.go b/server/issue.go index d2dcb6395..f45744425 100644 --- a/server/issue.go +++ b/server/issue.go @@ -28,6 +28,7 @@ const ( priorityField = "priority" descriptionField = "description" resolutionField = "resolution" + assigneeField = "assignee" ) func makePost(userID, channelID, message string) *model.Post { @@ -811,12 +812,17 @@ func getIssueCustomFieldValue(issue *jira.Issue, key string) StringSet { func getIssueFieldValue(issue *jira.Issue, key string) StringSet { key = strings.ToLower(key) switch key { - case statusField: + case statusField: return NewStringSet(issue.Fields.Status.ID) - case labelsField: + case labelsField: return NewStringSet(issue.Fields.Labels...) - case priorityField: - if issue.Fields.Priority != nil { + case priorityField: + return NewStringSet(issue.Fields.Priority.ID) + case reporterField: + return NewStringSet(issue.Fields.Reporter.AccountID) + case assigneeField: + return NewStringSet(issue.Fields.Assignee.AccountID) + if issue.Fields.Priority != nil { return NewStringSet(issue.Fields.Priority.ID) } case "fixversions": diff --git a/server/manifest.go b/server/manifest.go index 37d2ddf8a..00cf519a1 100644 --- a/server/manifest.go +++ b/server/manifest.go @@ -7,5 +7,5 @@ var manifest = struct { Version string }{ ID: "jira", - Version: "3.2.0", + Version: "3.2.1", } diff --git a/webapp/src/components/modals/channel_subscriptions/channel_subscription_filter.tsx b/webapp/src/components/modals/channel_subscriptions/channel_subscription_filter.tsx index 9abdf12e6..bec2e32eb 100644 --- a/webapp/src/components/modals/channel_subscriptions/channel_subscription_filter.tsx +++ b/webapp/src/components/modals/channel_subscriptions/channel_subscription_filter.tsx @@ -5,7 +5,7 @@ import {Theme} from 'mattermost-redux/types/preferences'; import ReactSelectSetting from 'components/react_select_setting'; import JiraEpicSelector from 'components/data_selectors/jira_epic_selector'; -import {isEpicLinkField, isMultiSelectField, isLabelField} from 'utils/jira_issue_metadata'; +import {isEpicLinkField, isMultiSelectField, isLabelField, isUserField} from 'utils/jira_issue_metadata'; import {FilterField, FilterValue, ReactSelectOption, IssueMetadata, IssueType, FilterFieldInclusion} from 'types/model'; import ConfirmModal from 'components/confirm_modal'; import JiraAutoCompleteSelector from 'components/data_selectors/jira_autocomplete_selector'; @@ -262,6 +262,15 @@ export default class ChannelSubscriptionFilter extends React.PureComponent ); + } else if (isUserField(field)) { + valueSelector = ( + + ); } else { valueSelector = ( field.schema.type === 'user' && !field.allowedValues) as (StringArrayField & FieldWithInfo)[]; + const populatedUserFields = userFields.map((field) => { + return { + key: field.key, + name: field.name, + schema: field.schema, + issueTypes: field.validIssueTypes, + } as FilterField; + }); + + const userResult = populatedFields.concat(populatedUserFields); + const stringArrayFields = fields.filter((field) => field.schema.type === 'array' && field.schema.items === 'string' && !field.allowedValues) as (StringArrayField & FieldWithInfo)[]; const userDefinedFields = stringArrayFields.map((field) => { return { @@ -210,7 +222,7 @@ export function getCustomFieldFiltersForProjects(metadata: IssueMetadata | null, } as FilterField; }); - const result = populatedFields.concat(userDefinedFields); + const result = userResult.concat(userDefinedFields); const epicLinkField = fields.find(isEpicLinkField); if (epicLinkField) { result.unshift({ @@ -264,6 +276,10 @@ export function isLabelField(field: JiraField | FilterField): boolean { return field.schema.system === 'labels' || field.schema.custom === 'com.atlassian.jira.plugin.system.customfieldtypes:labels'; } +export function isUserField(field: JiraField | FilterField): boolean { + return field.schema.type === 'user' || field.schema.custom === 'com.atlassian.jira.plugin.system.customfieldtypes:userpicker'; +} + export function isEpicIssueType(issueType: IssueType): boolean { return issueType.name === 'Epic'; }