| 236 | } |
| 237 | |
| 238 | loadCommentReactions() { |
| 239 | if (!this.accessToken) { |
| 240 | this.state.commentReactions = {} |
| 241 | return Promise.resolve([]) |
| 242 | } |
| 243 | |
| 244 | const comments = this.state.comments |
| 245 | const comentReactions = {} |
| 246 | |
| 247 | return Promise.all(comments.map((comment) => { |
| 248 | if (!comment.reactions.total_count) return [] |
| 249 | |
| 250 | const { owner, repo } = this |
| 251 | return http.get(`/repos/${owner}/${repo}/issues/comments/${comment.id}/reactions`, {}) |
| 252 | })) |
| 253 | .then(reactionsArray => { |
| 254 | comments.forEach((comment, index) => { |
| 255 | comentReactions[comment.id] = reactionsArray[index] |
| 256 | }) |
| 257 | this.state.commentReactions = comentReactions |
| 258 | |
| 259 | return comentReactions |
| 260 | }) |
| 261 | } |
| 262 | |
| 263 | login() { |
| 264 | window.location.href = this.loginLink |