This seems like a precarious way to test this, since it depends on the english translation never changing.
One thing you could do is check to see if inviting the user increases the private message topic count or not.
I like this feature a lot. I’ve added a few pieces of feedback.
It would be better to check for
SYSTEM_USER_ID than -1
I’m not sure we need to raise an error for this. You could pass
users.uniq to your future query and it’ll silently ignore any duplicates.
It’s a little cumbersome to pass
no_exception to a method like this.
The “rails way” would be to add a bang
! at the end if you want it to raise an exception or not. However in this case it looks like the method is only called in two actions, one which requires it and one which does not.
What I would recommend is never raising an exception in the method, but in the action that requires it check the return value, and if blank, raise the exception there.
if params[:notify_users].to_s == "true"