Fixed group share members search for mail notifications

Issue #11808, my changes described there yesterday.
Just use `if (!empty($groups)) {` instead