Remove unused awards `checkMutuality` method
Problem
The checkMutuality method in awards_handler.js appears to no longer be used,
Background
The following discussion from !141930 (merged) should be addressed:
-
@lorenzvanherwaarden started a discussion: (+1 comment) question (non-blocking): were you able to test this case @annabeldunstone? I was trying to but I think
checkMutuality()never gets called becausecheckForMutualityargument in theaddAwardToEmojiBarfunction is alwaysfalseorundefined.Here's a mermaid diagram of the functions calling each other in
awards_handler.jsthat are related tocheckMutuality(The nodes are functions):graph TD bindEvents -->|checkForMutuality: undefined| addAward addAward -->|checkForMutuality| addAwardToEmojiBar addAwardToEmojiBar -.->|only called when checkForMutuality is truthy or null| checkMutuality checkMutuality -->|checkForMutuality: false| addAwardHowever, this is not really related to this MR, so I think we could do the cleanup in a follow-up.
I also don't think the
callbackargument inaddAwardis ever set.P.S.: sometimes
checkMutualityis used as the argument name instead ofcheckForMutuality, but I simplified it for some consistency in the diagram and explanation so I'm always referencingcheckForMutualityas the argument andcheckMutualityas the function. -
@ekigboresponseAFAICT
addAwardToEmojiBaris called with acheckMutualityparameter in theaddAwardmethod, but none of the calls toaddAward(except in tests) actually set a value for thecheckMutualityparameter (except in thecheckMutualitymethod itself where it is givenfalse), so i dont think this is used anymore🤔 .Furthermore, if i'm reading this correctly, I think the aim is to ensure you can't react with both
thumbsupANDthumbsdown, but it looks like that isnt working
Implementation guide
- In awards_handler.js:
- Remove
checkMutuality()method - Remove
checkMutualityandcheckForMutualityarguments ofaddAward()andaddAwardToEmojiBar()methods and make sure that code calling these methods don't pass those mutuality arguments. - Remove calls to
checkMutuality()
- Remove
- Adapt awards_handler_spec.js so it reflects the changes made in awards_handler.js
