StackStorm / hubot-stackstorm

Hubot plugin for integration with StackStorm event-driven infrastructure automation platform.
Apache License 2.0
49 stars 39 forks source link

Redo adapter inheritance #191

Closed blag closed 5 years ago

blag commented 5 years ago

This PR is on top of #190.

This PR slightly refactors the adapter inheritance for Slack-like adapters.

It adds in an intermediary SlackLikeAdapter for the Slack-like providers. This should make it easier to use DefaultAdapter methods in subclasses, like with what is done in SparkAdapter.formatData and SlackLikeAdapter.normalizeCommand.

This makes things a bit easier:

-ThisAdapter.super_.prototype.customMethod.call(...)
+DefaultAdapter.customMethod(...)

I also removed the normalizeAddressee from the MS Teams adapter, since it was an override of the same function from DefaultAdapter (and the MS Teams adapter inherits from DefaultAdapter). The two functions were identical, however, so it makes no sense to override that function. And since the two functions were identical, I didn't need to change the tests at all for this fix.

~Once #190 is merged, I will either rebase and merge this with GitHub, or I will manually rebase this branch on that one, force push, and merge it.~ Done.

blag commented 5 years ago

I fixed a few things in the changelog, and added PR references to the most recent changes, including #190.