Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in blockAction handler to SlackFunction #1657

Merged
merged 4 commits into from Nov 29, 2022

Conversation

hello-ashleyintech
Copy link
Contributor

Summary

In #1645 we introduced SlackFunction.blockSuggestion() as a handler for the block_suggestions event. While we already have a .action() handler for block_actions, we should also add in a SlackFunction.blockAction() handler to be consistent with this naming convention so folks can use either .action() or .blockAction() as they wish!

Requirements (place an x in each [ ])

@hello-ashleyintech hello-ashleyintech added the enhancement M-T: A feature request for new functionality label Nov 16, 2022
@hello-ashleyintech hello-ashleyintech self-assigned this Nov 16, 2022
@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

❗ No coverage uploaded for pull request base (next-gen@d8a970e). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 53fcf59 differs from pull request most recent head 4f87db4. Consider uploading reports for the commit 4f87db4 to get more accurate results

@@             Coverage Diff             @@
##             next-gen    #1657   +/-   ##
===========================================
  Coverage            ?   80.71%           
===========================================
  Files               ?       20           
  Lines               ?     1779           
  Branches            ?      505           
===========================================
  Hits                ?     1436           
  Misses              ?      221           
  Partials            ?      122           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@srajiang srajiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hello! Yay thank you for adding this functionality. I was wondering if you'd considered just reusing the Function's action method within the blockAction method, to make it super explicit that this is an alias?

Something like:

export class SlackFunction {

 action(){

 }

blockAction(){
   return this.action.apply(this, arguments);
 }

}

@@ -332,6 +370,71 @@ describe('SlackFunction module', () => {
assertNode.rejects(shouldReject);
});
});
it('app.function.blockAction() should execute all provided callbacks', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on locating this test and the one below it within `describe('runInteractivityHandlers', ....) on ln241?

* This function is added as an alias for the action() function to create
* consistency with having a blockSuggestion() function.
*
* NOTE: This function is a direct copy of the action() function and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to use the .action() function within blockAction instead of copying the code? If we can do this, it would probably reduce the likelihood of accidental drift between the two interfaces, since we expect them to be the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absolutely! I'll try what you suggested above and have this updated by later today! 🙌

Copy link
Member

@srajiang srajiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 :shipit:

@hello-ashleyintech hello-ashleyintech merged commit 1710cf0 into next-gen Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants