chg: [user:saveNotificationSettings] Make sure tags filter is a valid json

pull/8575/head
Sami Mokaddem 2022-09-07 09:08:00 +02:00
parent b2174754ec
commit 90cab66b86
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 5 additions and 1 deletions

View File

@ -2783,11 +2783,11 @@ class UsersController extends AppController
if (!empty($success)) {
$message = __('Notification settings saved');
$this->Flash->success($message);
$this->redirect(['action' => 'view', 'me']);
} else {
$message = __('Notification settings could not be saved');
$this->Flash->error($message);
}
$this->redirect(['action' => 'view', 'me']);
}
$user['periodic_settings'] = $this->User->extractPeriodicSettingForUser($user);
$this->request->data = $user;

View File

@ -1695,6 +1695,10 @@ class User extends AppModel
]);
if ($success) {
$periodic_settings = $data['periodic_settings'];
$decodedTags = json_decode($periodic_settings['tags'], true);
if ($decodedTags === null) {
return false;
}
$notification_filters = [
'orgc_id' => $periodic_settings['orgc_id'] ?? [],
'published' => $periodic_settings['published'] ?? '',