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-2736]: Done the review fixes of a github PR #636 #21

Merged
merged 8 commits into from
Feb 16, 2023
Prev Previous commit
Next Next commit
[MI-2736]: Review fixes done
1. Improved code readability
  • Loading branch information
Nityanand13 committed Feb 10, 2023
commit 211089f0b271e7428e2ef48090c6d6f80f78c42b
8 changes: 4 additions & 4 deletions server/plugin/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ func (p *Plugin) initializeAPI() {
apiRouter.HandleFunc("/searchissues", p.checkAuth(p.attachUserContext(p.searchIssues), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/yourassignments", p.checkAuth(p.attachUserContext(p.getYourAssignments), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/createissue", p.checkAuth(p.attachUserContext(p.createIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/closeorreopenissue", p.checkAuth(p.attachUserContext(p.closeOrReopenIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/updateissue", p.checkAuth(p.attachUserContext(p.updateIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/editissuemodal", p.checkAuth(p.attachUserContext(p.openIssueEditModal), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/close_or_reopen_issue", p.checkAuth(p.attachUserContext(p.closeOrReopenIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/update_issue", p.checkAuth(p.attachUserContext(p.updateIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/edit_issue_modal", p.checkAuth(p.attachUserContext(p.openIssueEditModal), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/close_reopen_issue_modal", p.checkAuth(p.attachUserContext(p.openCloseOrReopenIssueModal), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/attachcommentissuemodal", p.checkAuth(p.attachUserContext(p.openAttachCommentIssueModal), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/attach_comment_issue_modal", p.checkAuth(p.attachUserContext(p.openAttachCommentIssueModal), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/createissuecomment", p.checkAuth(p.attachUserContext(p.createIssueComment), ResponseTypePlain)).Methods(http.MethodPost)
manojmalik20 marked this conversation as resolved.
Show resolved Hide resolved
apiRouter.HandleFunc("/mentions", p.checkAuth(p.attachUserContext(p.getMentions), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/unreads", p.checkAuth(p.attachUserContext(p.getUnreads), ResponseTypePlain)).Methods(http.MethodGet)
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {id as pluginId} from '../manifest';

export default class Client {
editIssueModal = async (payload) => {
return this.doPost(`${this.url}/editissuemodal`, payload);
return this.doPost(`${this.url}/edit_issue_modal`, payload);
}

closeOrReopenIssueModal = async (payload) => {
return this.doPost(`${this.url}/close_reopen_issue_modal`, payload);
}

attachCommentIssueModal = async (payload) => {
return this.doPost(`${this.url}/attachcommentissuemodal`, payload);
return this.doPost(`${this.url}/attach_comment_issue_modal`, payload);
}

setServerRoute(url) {
Expand Down Expand Up @@ -76,11 +76,11 @@ export default class Client {
}

closeOrReopenIssue = async (payload) => {
return this.doPost(`${this.url}/closeorreopenissue`, payload);
return this.doPost(`${this.url}/close_or_reopen_issue`, payload);
}

updateIssue = async (payload) => {
return this.doPost(`${this.url}/updateissue`, payload);
return this.doPost(`${this.url}/update_issue`, payload);
}

searchIssues = async (searchTerm) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
value: milestone_number,
label: milestone_title,
},
repo: {
name: repo_full_name,
},
issueDescription: description,
repo: repo_full_name,
issueTitle: title.substring(0, MAX_TITLE_LENGTH)});
}
}
Expand Down Expand Up @@ -151,29 +153,28 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
handleIssueDescriptionChange = (issueDescription) => this.setState({issueDescription});

renderIssueAttributeSelectors = () => {
if (!this.state.repo || (this.state.repo.permissions && !this.state.repo.permissions.push)) {
if (!this.state.repo || !this.state.repo.name || (this.state.repo.permissions && !this.state.repo.permissions.push)) {
return null;
}

const repoName = this.state.repo.name ?? this.state.repo;
return (
<>
<GithubLabelSelector
repoName={repoName}
repoName={this.state.repo.name}
theme={this.props.theme}
selectedLabels={this.state.labels}
onChange={this.handleLabelsChange}
/>

<GithubAssigneeSelector
repoName={repoName}
repoName={this.state.repo.name}
theme={this.props.theme}
selectedAssignees={this.state.assignees}
onChange={this.handleAssigneesChange}
/>

<GithubMilestoneSelector
repoName={repoName}
repoName={this.state.repo.name}
theme={this.props.theme}
selectedMilestone={this.state.milestone}
onChange={this.handleMilestoneChange}
Expand Down