WordPoints / hooks-api

A basic API for hooking into user actions https://github.com/WordPoints/wordpoints/issues/321
GNU General Public License v2.0
0 stars 0 forks source link

Reverse blocker extension #102

Closed JDGrimes closed 8 years ago

JDGrimes commented 8 years ago

In https://github.com/WordPoints/hooks-api/issues/66#issuecomment-187420112 we've concluded that we need to introduce an extension that can block reverse firers for particular reactions.

From https://github.com/WordPoints/hooks-api/issues/66#issuecomment-183487741:

Partial-reversing Reactors

There is also a third component to this issue, and that is the case where a reactor really does handle some reversals, but not all reactions that that reactor handles should be reversed. This is a more recent development, or it has only been more recently noted that it is a necessity if we want to import certain points hooks and maintain back-compat (see #69 (comment)). Basically, some legacy points hooks could have reversals completely disabled. So in order to be able to import those points hooks to the points reactor, we need to be able to disable reversals on a per-reaction basis.

JDGrimes commented 8 years ago

I happened to think, I wonder if we could make this more generic and allow it to be used to block fires from any sort of firer, based on the firer slug. I guess there are some complications there though, because the extension would have to implement an interface to listen for each fire type. (Beside the main firer of course, although I'm wondering whether we should force ourselves to defend that and not just take it for what it is.)

So I guess that would only be useful if we introduce the concept of generic extensions that listen for every type of fire. Though I'm not sure that would really be maintainable. I guess it would have some usefulness, as in this case, but it could also be misused if not properly understood. That would be something for another ticket though.

JDGrimes commented 8 years ago

Looking at this I was wondering if we could also use it to completely disable a reaction, but that would require all firers to be blocked. We could do that if we allowed this to have a global setting instead of per-firer settings (something actually discussed in #103). However, depending on how the settings were stored, that could cause the global option to overwrite the per-firer options, which would mean the per-firer blocking would have been destroyed when the reaction was re-enabled. Anyway, that's a discussion for another ticket.