Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MI-2814] Done the review fixes of github PR #636 #22

Merged
merged 14 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class AttachIssueModal extends PureComponent {
owner,
repo,
number,
comment: this.props.post.message,
comment: this.state.comment,
post_id: this.props.post.id,
show_attached_message: true,
};
Expand Down Expand Up @@ -106,9 +106,17 @@ export default class AttachIssueModal extends PureComponent {
});
};

/* eslint-disable react/no-did-update-set-state*/
Nityanand13 marked this conversation as resolved.
Show resolved Hide resolved
componentDidUpdate(prevProps) {
if (this.props.post && !this.props.messageData && !prevProps.post) {
this.setState({comment: this.props.post.message});
}
}
/* eslint-enable */

render() {
const {error, submitting, comment, issueValue} = this.state;
const {visible, theme, messageData, post} = this.props;
const {visible, theme, messageData} = this.props;
const style = getStyle(theme);
if (!visible) {
return null;
Expand Down Expand Up @@ -138,10 +146,9 @@ export default class AttachIssueModal extends PureComponent {
<Input
label='Message Attached to GitHub Issue'
type='textarea'
isDisabled={false}
value={post?.message}
value={comment}
disabled={false}
readOnly={true}
onChange={this.handleIssueCommentChange}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const initialState = {
repo: null,
issueTitle: '',
issueDescription: '',
channelID: '',
channelId: '',
labels: [],
assignees: [],
milestone: null,
Expand Down Expand Up @@ -62,23 +62,23 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
labels = [];
}

this.setState({assignees});
this.setState({labels});
this.setState({milestone: {
value: milestone_number,
label: milestone_title,
},
repo: {
name: repo_full_name,
},
channelID: channel_id,
assignees,
labels,
channelId: channel_id,
issueDescription: description,
issueTitle: title.substring(0, MAX_TITLE_LENGTH)});
}

/* eslint-disable react/no-did-update-set-state*/
componentDidUpdate(prevProps) {
if (this.props.post && !this.props.messageData) {
if (this.props.post && !this.props.messageData && !prevProps.post) {
this.setState({issueDescription: this.props.post.message});
}

Expand Down Expand Up @@ -118,7 +118,7 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
assignees: this.state.assignees,
milestone: this.state.milestone && this.state.milestone.value,
post_id: postId,
channel_id: this.state.channelID,
channel_id: this.state.channelId,
issue_number,
};

Expand Down Expand Up @@ -252,6 +252,7 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
onChange={this.handleIssueTitleChange}
/>
{issueTitleValidationError}

Nityanand13 marked this conversation as resolved.
Show resolved Hide resolved
{this.renderIssueAttributeSelectors()}

<Input
Expand Down