teleological / redmine_stealth

Sometimes sneaky is good. This plugin works like a mute button for Redmine notification emails.
http://teleological.github.com/redmine_stealth
GNU General Public License v2.0
31 stars 35 forks source link

Check whether RedmineStealth is present in a Redmine install #35

Closed franfabrizio closed 8 years ago

franfabrizio commented 8 years ago

I'm looking for a way to test whether the RedmineStealth plugin/module has been loaded in a given Redmine instance. The Redmine plugin internals FAQ suggests:

If your project is in the @project variable: if @project.module_enabled?("")

but this plugin is not registered as a project-level module. More generally, sometimes Ruby modules define a constant that you can check against, e.g.

if defined?(ActiveSupport)

but I don't see any such constant in RedmineStealth.

Is there another clean way to check? I'm working on an extension to alert users about who was notified by email when they make a change. Since we use the RedmineStealth plugin, sometimes people who would normally be alerted are not, so I want my code to reflect that, but at the same time not break for another Redmine instance that doesn't use RedmineStealth.

franfabrizio commented 8 years ago

I ended up just going with Object.const_defined?("RedmineStealth") for this. Worked fine.