Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 5f361e2

Browse files
author
vikasrohit
committedJul 27, 2016
Merge branch 'feature/remove-email-subscription-logic-new-user' into dev
2 parents 268d7f8 + bbc844f commit 5f361e2

File tree

2 files changed

+2
-55
lines changed

2 files changed

+2
-55
lines changed
 

‎app/skill-picker/skill-picker.controller.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import _ from 'lodash'
66

77
angular.module('tc.skill-picker').controller('SkillPickerController', SkillPickerController)
88

9-
SkillPickerController.$inject = ['$scope', 'CONSTANTS', 'ProfileService', '$state', 'userProfile', 'featuredSkills', 'logger', 'toaster', 'MemberCertService', '$q', 'UserPreferencesService']
9+
SkillPickerController.$inject = ['$scope', 'CONSTANTS', 'ProfileService', '$state', 'userProfile', 'featuredSkills', 'logger', 'toaster', 'MemberCertService', '$q']
1010

11-
function SkillPickerController($scope, CONSTANTS, ProfileService, $state, userProfile, featuredSkills, logger, toaster, MemberCertService, $q, UserPreferencesService) {
11+
function SkillPickerController($scope, CONSTANTS, ProfileService, $state, userProfile, featuredSkills, logger, toaster, MemberCertService, $q) {
1212
var vm = this
1313
vm.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX
1414
vm.IOS_PROGRAM_ID = CONSTANTS.SWIFT_PROGRAM_ID
@@ -32,7 +32,6 @@ import _ from 'lodash'
3232
* Activates the controller.
3333
*/
3434
function activate() {
35-
addToMailingList()
3635
initCommunities()
3736
checkCommunityStatus()
3837
}
@@ -138,25 +137,6 @@ import _ from 'lodash'
138137
}
139138
}
140139

141-
function addToMailingList() {
142-
return UserPreferencesService.getEmailPreferences(userProfile).then(function(subscription) {
143-
logger.debug(subscription)
144-
if (!subscription) {
145-
return UserPreferencesService.saveEmailPreferences(userProfile).then(function(resp) {
146-
logger.debug(resp)
147-
}).catch(function(err) {
148-
// no error to user
149-
//TODO some error alert to community admin
150-
logger.debug('error in adding user to member list')
151-
})
152-
}
153-
}).catch(function(err) {
154-
// no error to user
155-
//TODO some error alert to community admin
156-
logger.debug('error in adding user to member list')
157-
})
158-
}
159-
160140
/**
161141
* Persists the user's altered information.
162142
*/

‎app/skill-picker/skill-picker.spec.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -138,39 +138,6 @@ describe('Skill Picker Controller', function() {
138138
CONSTANTS.SWIFT_PROGRAM_ID = origSwiftProgId
139139
})
140140

141-
it('should call mailchimp service to add subscription', function() {
142-
expect(vm).to.exist
143-
// getEmailPreferences should always be called
144-
expect(userPrefSvc.getEmailPreferences).to.be.calledOnce
145-
// saveEmailPreferences should be called once if not subscribed
146-
// getEmailPreferences service mock returns null for mockProfile.userId
147-
expect(userPrefSvc.saveEmailPreferences).to.be.calledOnce
148-
})
149-
150-
it('should not call mailchimp service to add subscription', function() {
151-
// reset getEmailPreferences, saveEmailPreferences spy's called count
152-
userPrefSvc.getEmailPreferences.reset()
153-
userPrefSvc.saveEmailPreferences.reset()
154-
var scope = $rootScope.$new()
155-
156-
var profile = angular.copy(mockProfile)
157-
// update userId to return valid object in service mock
158-
profile.userId = 12345
159-
vm = $controller('SkillPickerController', {
160-
$scope: scope,
161-
userProfile: profile,
162-
featuredSkills: [],
163-
$state: state
164-
})
165-
$rootScope.$digest()
166-
expect(vm).to.exist
167-
// getEmailPreferences should always be called
168-
expect(userPrefSvc.getEmailPreferences).to.be.calledOnce
169-
// saveEmailPreferences should not be called if already subscribed
170-
// getEmailPreferences service mock returns valid object for userId 12345
171-
expect(userPrefSvc.saveEmailPreferences).not.to.be.called
172-
})
173-
174141
it('should add skill ', function() {
175142
vm.toggleSkill(409)
176143
expect(vm.mySkills).to.exist.have.length(1)

0 commit comments

Comments
 (0)