Skip to content

Commit 211089f

Browse files
committed
[MI-2736]: Review fixes done
1. Improved code readability
1 parent 5c8d8f7 commit 211089f

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

server/plugin/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ func (p *Plugin) initializeAPI() {
9595
apiRouter.HandleFunc("/searchissues", p.checkAuth(p.attachUserContext(p.searchIssues), ResponseTypePlain)).Methods(http.MethodGet)
9696
apiRouter.HandleFunc("/yourassignments", p.checkAuth(p.attachUserContext(p.getYourAssignments), ResponseTypePlain)).Methods(http.MethodGet)
9797
apiRouter.HandleFunc("/createissue", p.checkAuth(p.attachUserContext(p.createIssue), ResponseTypePlain)).Methods(http.MethodPost)
98-
apiRouter.HandleFunc("/closeorreopenissue", p.checkAuth(p.attachUserContext(p.closeOrReopenIssue), ResponseTypePlain)).Methods(http.MethodPost)
99-
apiRouter.HandleFunc("/updateissue", p.checkAuth(p.attachUserContext(p.updateIssue), ResponseTypePlain)).Methods(http.MethodPost)
100-
apiRouter.HandleFunc("/editissuemodal", p.checkAuth(p.attachUserContext(p.openIssueEditModal), ResponseTypePlain)).Methods(http.MethodPost)
98+
apiRouter.HandleFunc("/close_or_reopen_issue", p.checkAuth(p.attachUserContext(p.closeOrReopenIssue), ResponseTypePlain)).Methods(http.MethodPost)
99+
apiRouter.HandleFunc("/update_issue", p.checkAuth(p.attachUserContext(p.updateIssue), ResponseTypePlain)).Methods(http.MethodPost)
100+
apiRouter.HandleFunc("/edit_issue_modal", p.checkAuth(p.attachUserContext(p.openIssueEditModal), ResponseTypePlain)).Methods(http.MethodPost)
101101
apiRouter.HandleFunc("/close_reopen_issue_modal", p.checkAuth(p.attachUserContext(p.openCloseOrReopenIssueModal), ResponseTypePlain)).Methods(http.MethodPost)
102-
apiRouter.HandleFunc("/attachcommentissuemodal", p.checkAuth(p.attachUserContext(p.openAttachCommentIssueModal), ResponseTypePlain)).Methods(http.MethodPost)
102+
apiRouter.HandleFunc("/attach_comment_issue_modal", p.checkAuth(p.attachUserContext(p.openAttachCommentIssueModal), ResponseTypePlain)).Methods(http.MethodPost)
103103
apiRouter.HandleFunc("/createissuecomment", p.checkAuth(p.attachUserContext(p.createIssueComment), ResponseTypePlain)).Methods(http.MethodPost)
104104
apiRouter.HandleFunc("/mentions", p.checkAuth(p.attachUserContext(p.getMentions), ResponseTypePlain)).Methods(http.MethodGet)
105105
apiRouter.HandleFunc("/unreads", p.checkAuth(p.attachUserContext(p.getUnreads), ResponseTypePlain)).Methods(http.MethodGet)

webapp/src/client/client.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {id as pluginId} from '../manifest';
88

99
export default class Client {
1010
editIssueModal = async (payload) => {
11-
return this.doPost(`${this.url}/editissuemodal`, payload);
11+
return this.doPost(`${this.url}/edit_issue_modal`, payload);
1212
}
1313

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

1818
attachCommentIssueModal = async (payload) => {
19-
return this.doPost(`${this.url}/attachcommentissuemodal`, payload);
19+
return this.doPost(`${this.url}/attach_comment_issue_modal`, payload);
2020
}
2121

2222
setServerRoute(url) {
@@ -76,11 +76,11 @@ export default class Client {
7676
}
7777

7878
closeOrReopenIssue = async (payload) => {
79-
return this.doPost(`${this.url}/closeorreopenissue`, payload);
79+
return this.doPost(`${this.url}/close_or_reopen_issue`, payload);
8080
}
8181

8282
updateIssue = async (payload) => {
83-
return this.doPost(`${this.url}/updateissue`, payload);
83+
return this.doPost(`${this.url}/update_issue`, payload);
8484
}
8585

8686
searchIssues = async (searchTerm) => {

webapp/src/components/modals/create_update_issue/create_update_issue.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
6464
value: milestone_number,
6565
label: milestone_title,
6666
},
67+
repo: {
68+
name: repo_full_name,
69+
},
6770
issueDescription: description,
68-
repo: repo_full_name,
6971
issueTitle: title.substring(0, MAX_TITLE_LENGTH)});
7072
}
7173
}
@@ -151,29 +153,28 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
151153
handleIssueDescriptionChange = (issueDescription) => this.setState({issueDescription});
152154

153155
renderIssueAttributeSelectors = () => {
154-
if (!this.state.repo || (this.state.repo.permissions && !this.state.repo.permissions.push)) {
156+
if (!this.state.repo || !this.state.repo.name || (this.state.repo.permissions && !this.state.repo.permissions.push)) {
155157
return null;
156158
}
157159

158-
const repoName = this.state.repo.name ?? this.state.repo;
159160
return (
160161
<>
161162
<GithubLabelSelector
162-
repoName={repoName}
163+
repoName={this.state.repo.name}
163164
theme={this.props.theme}
164165
selectedLabels={this.state.labels}
165166
onChange={this.handleLabelsChange}
166167
/>
167168

168169
<GithubAssigneeSelector
169-
repoName={repoName}
170+
repoName={this.state.repo.name}
170171
theme={this.props.theme}
171172
selectedAssignees={this.state.assignees}
172173
onChange={this.handleAssigneesChange}
173174
/>
174175

175176
<GithubMilestoneSelector
176-
repoName={repoName}
177+
repoName={this.state.repo.name}
177178
theme={this.props.theme}
178179
selectedMilestone={this.state.milestone}
179180
onChange={this.handleMilestoneChange}

0 commit comments

Comments
 (0)