Skip to content

Commit

Permalink
[MM-62634] Change the fix for LinkTooltip to be backward compatible f…
Browse files Browse the repository at this point in the history
…or jira plugin (#1149)
  • Loading branch information
M-ZubairAhmed authored Jan 26, 2025
1 parent 2932c16 commit d9214df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage_url": "https://github.com/mattermost/mattermost-plugin-jira",
"support_url": "https://github.com/mattermost/mattermost-plugin-jira/issues",
"icon_path": "assets/icon.svg",
"min_server_version": "10.5.0",
"min_server_version": "7.8.0",
"server": {
"executables": {
"darwin-amd64": "server/dist/plugin-darwin-amd64",
Expand Down
26 changes: 19 additions & 7 deletions webapp/src/components/jira_ticket_tooltip/jira_ticket_tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,31 +81,43 @@ export default class TicketPopover extends React.PureComponent<Props, State> {
return null;
};

componentDidMount() {
fetchIssue = (show: boolean, connected: boolean, ticketId?: string, ticketDetails?: TicketDetails | null): void => {
const issueKey = this.getIssueKey();
if (!issueKey) {
return;
}

const {instanceID} = issueKey;
if (this.props.show && this.state.ticketId && !this.state.ticketDetails) {
this.props.fetchIssueByKey(this.state.ticketId, instanceID).then((res: {data?: TicketData, error?: any}) => {
if (!show) {
return;
}

if (ticketId && !ticketDetails) {
this.props.fetchIssueByKey(ticketId, issueKey.instanceID).then((res: {data?: TicketData, error?: any}) => {
if (res.error) {
this.setState({error: 'There was a problem loading the details for this Jira link'});
return;
}

const updatedTicketDetails = getJiraTicketDetails(res.data);
if (this.props.connected && updatedTicketDetails && updatedTicketDetails.ticketId === this.state.ticketId) {
if (connected && updatedTicketDetails && updatedTicketDetails.ticketId === ticketId) {
this.setState({
ticketDetails: updatedTicketDetails,
error: null,
});
}
});
}
};

componentDidMount(): void {
this.fetchIssue(this.props.show, this.props.connected, this.state.ticketId, this.state.ticketDetails);
}

componentDidUpdate(): void {
this.fetchIssue(this.props.show, this.props.connected, this.state.ticketId, this.state.ticketDetails);
}

fixVersionLabel(fixVersion: string) {
fixVersionLabel(fixVersion: string): ReactNode {
if (fixVersion) {
const fixVersionString = 'Fix Version :';
return (
Expand All @@ -121,7 +133,7 @@ export default class TicketPopover extends React.PureComponent<Props, State> {
return null;
}

tagTicketStatus(ticketStatus: string) {
tagTicketStatus(ticketStatus: string): ReactNode {
let ticketStatusClass = 'default-style ticket-status--default';

const myStatusClass = myStatusClasses[ticketStatus && ticketStatus.toLowerCase()];
Expand Down

0 comments on commit d9214df

Please sign in to comment.