Skip to content

Commit 09c0da6

Browse files
authored
Merge pull request #182 from thomas694/master
Fix issue #180 [BUG] Cloned issues have their comments "scrambled"
2 parents 458956c + 1c02954 commit 09c0da6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

app.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,16 @@ function cloneOldIssueComments(newIssue, repo, url) {
355355
return Promise.resolve(null)
356356
}
357357

358-
const promises = []
359-
comments.data.forEach((comment) => {
360-
const c = {
361-
body: comment.body,
362-
}
363-
promises.push(ajaxRequest('POST', c, `https://api.github.com/repos/${repo}/issues/${newIssue}/comments`))
364-
})
365-
366-
Promise.all(promises).then((res) => {
367-
return Promise.resolve({})
358+
comments.data.reduce(
359+
(p, comment) => p.then(_ => {
360+
const c = {
361+
body: comment.body,
362+
}
363+
return ajaxRequest('POST', c, `https://api.github.com/repos/${repo}/issues/${newIssue}/comments`)
364+
}),
365+
Promise.resolve()
366+
).then((res) => {
367+
return Promise.resolve({})
368368
})
369369
}
370370
)

0 commit comments

Comments
 (0)