@@ -5,9 +5,9 @@ import angular from 'angular'
5
5
6
6
angular . module ( 'tc.settings' ) . controller ( 'EmailSettingsController' , EmailSettingsController )
7
7
8
- EmailSettingsController . $inject = [ '$rootScope' , 'userProfile ' , 'ProfileService' , 'MailchimpService' , 'logger' , 'CONSTANTS' , 'toaster' , '$q' , '$scope' ]
8
+ EmailSettingsController . $inject = [ '$rootScope' , 'userData ' , 'ProfileService' , 'MailchimpService' , 'logger' , 'CONSTANTS' , 'toaster' , '$q' , '$scope' ]
9
9
10
- function EmailSettingsController ( $rootScope , userProfile , ProfileService , MailchimpService , logger , CONSTANTS , toaster , $q , $scope ) {
10
+ function EmailSettingsController ( $rootScope , userData , ProfileService , MailchimpService , logger , CONSTANTS , toaster , $q , $scope ) {
11
11
var vm = this
12
12
vm . loading = false
13
13
vm . saving = false
@@ -63,11 +63,11 @@ import angular from 'angular'
63
63
]
64
64
65
65
vm . loading = true
66
- return MailchimpService . getMemberSubscription ( userProfile ) . then ( function ( subscription ) {
66
+ return MailchimpService . getMemberSubscription ( userData ) . then ( function ( subscription ) {
67
67
vm . loading = false
68
68
if ( ! subscription ) {
69
- // add member to the list with empty preferences
70
- MailchimpService . addSubscription ( userProfile , { } ) . then ( function ( resp ) {
69
+ // add member to the list with default preferences
70
+ MailchimpService . addSubscription ( userData , { } ) . then ( function ( resp ) {
71
71
logger . debug ( resp )
72
72
} ) . catch ( function ( err ) {
73
73
// no error to user
@@ -102,7 +102,7 @@ import angular from 'angular'
102
102
vm . newsletters . forEach ( function ( newsletter ) {
103
103
preferences [ newsletter . id ] = newsletter . enabled
104
104
} )
105
- MailchimpService . addSubscription ( userProfile , preferences ) . then ( function ( resp ) {
105
+ MailchimpService . addSubscription ( userData , preferences ) . then ( function ( resp ) {
106
106
vm . loading = false
107
107
vm . saving = false
108
108
// reset dirty state for all newsletter options
0 commit comments