@@ -57,12 +57,10 @@ public function include_users( $p_event_name, $p_bug_id, $p_notify_type ) {
57
57
return $ users_to_include ;
58
58
}
59
59
60
- foreach ( $ t_project_config as $ username => $ enabled_notifications ) {
61
- if ( in_array ( $ p_notify_type , $ enabled_notifications ) ) {
62
- $ t_user_id = user_get_id_by_name ( $ username );
63
- array_push ( $ users_to_include , $ t_user_id );
64
- log_event ( LOG_PLUGIN , "user '%s' added as notification recipient for project %s " , $ username , $ t_project_name );
65
- }
60
+ foreach ( $ t_project_config as $ username ) {
61
+ $ t_user_id = user_get_id_by_name ( $ username );
62
+ array_push ( $ users_to_include , $ t_user_id );
63
+ log_event ( LOG_PLUGIN , "user '%s' added as notification recipient for project %s " , $ username , $ t_project_name );
66
64
}
67
65
68
66
return $ users_to_include ;
@@ -90,14 +88,9 @@ public function get_user_notification_preference( $p_event_name, $p_notify, $p_p
90
88
return $ t_return ;
91
89
}
92
90
93
- $ user_config = $ project_config [$ t_username ];
94
- if ( !is_array ( $ user_config ) ) {
95
- log_event ( LOG_PLUGIN , "notification settings for user %s don't exist for project %s " , $ t_username , $ t_project_name );
96
- return $ t_return ;
97
- }
98
-
99
91
// Only change notification settings if all sanity checks passed
100
- if ( in_array ( $ p_notify_type , $ user_config ) ) {
92
+ if ( in_array ( $ t_username , $ project_config ) ) {
93
+ log_event ( LOG_PLUGIN , "user %s notifications settings for project %s set to ON " , $ t_username , $ t_project_name );
101
94
$ t_return [0 ] = ON ;
102
95
}
103
96
@@ -128,6 +121,11 @@ private function get_config_for_project( $p_project_name ) {
128
121
return null ;
129
122
}
130
123
124
+ if ( !array_key_exists ( $ p_project_name , $ notification_config ) ) {
125
+ log_event ( LOG_PLUGIN , "notification settings for project %s don't exist " , $ p_project_name );
126
+ return null ;
127
+ }
128
+
131
129
$ project_config = $ notification_config [$ p_project_name ];
132
130
133
131
return is_array ( $ project_config ) ? $ project_config : null ;
0 commit comments