Disable demand status emails when mail notifications are disabled

This commit is contained in:
Thibaud Fabre
2015-11-02 15:49:46 +01:00
parent 1a75e33848
commit 938c92b0c1
2 changed files with 10 additions and 10 deletions

View File

@@ -490,6 +490,10 @@ class UserController extends Controller
}); });
unset ($cacheToUpdate); unset ($cacheToUpdate);
foreach ($done as $usr => $bases) {
$user = $userRepository->find($usr);
$acceptColl = $denyColl = [];
$hookName = WebhookEvent::USER_REGISTRATION_REJECTED; $hookName = WebhookEvent::USER_REGISTRATION_REJECTED;
$hookType = WebhookEvent::USER_REGISTRATION_TYPE; $hookType = WebhookEvent::USER_REGISTRATION_TYPE;
$hookData = [ $hookData = [
@@ -498,10 +502,6 @@ class UserController extends Controller
'rejected' => [] 'rejected' => []
]; ];
foreach ($done as $usr => $bases) {
$user = $userRepository->find($usr);
$acceptColl = $denyColl = [];
foreach ($bases as $bas => $isok) { foreach ($bases as $bas => $isok) {
$collection = \collection::get_from_base_id($this->app, $bas); $collection = \collection::get_from_base_id($this->app, $bas);
$label = $collection->get_label($this->app['locale']); $label = $collection->get_label($this->app['locale']);
@@ -518,7 +518,7 @@ class UserController extends Controller
$this->app['manipulator.webhook-event']->create($hookName, $hookType, $hookData); $this->app['manipulator.webhook-event']->create($hookName, $hookType, $hookData);
if (0 !== count($acceptColl) || 0 !== count($denyColl)) { if ($user->hasMailNotificationsActivated() && (0 !== count($acceptColl) || 0 !== count($denyColl))) {
$message = ''; $message = '';
if (0 !== count($acceptColl)) { if (0 !== count($acceptColl)) {
$message .= "\n" . $this->app->trans('login::register:email: Vous avez ete accepte sur les collections suivantes : ') . implode(', ', $acceptColl). "\n"; $message .= "\n" . $this->app->trans('login::register:email: Vous avez ete accepte sur les collections suivantes : ') . implode(', ', $acceptColl). "\n";

View File

@@ -1001,7 +1001,7 @@ class User
} }
/** /**
* @return ArrayCollection * @return ArrayCollection|UserNotificationSetting[]
*/ */
public function getNotificationSettings() public function getNotificationSettings()
{ {