MCPcopy
hub / github.com/imsun/gitment / unlikeAComment

Method unlikeAComment

src/gitment.js:327–340  ·  view source on GitHub ↗
(commentId)

Source from the content-addressed store, hash-verified

325 }
326
327 unlikeAComment(commentId) {
328 if (!this.accessToken) return Promise.reject()
329
330 const reactions = this.state.commentReactions[commentId]
331 const comment = this.state.comments.find(comment => comment.id === commentId)
332 const { user } = this.state
333 const index = reactions.findIndex(reaction => reaction.user.login === user.login)
334
335 return http.delete(`/reactions/${reactions[index].id}`)
336 .then(() => {
337 reactions.splice(index, 1)
338 comment.reactions.heart--
339 })
340 }
341}
342
343module.exports = Gitment

Callers 1

renderCommentsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected