@@ -6,9 +6,9 @@ import _ from 'lodash'
6
6
7
7
angular . module ( 'tc.skill-picker' ) . controller ( 'SkillPickerController' , SkillPickerController )
8
8
9
- SkillPickerController . $inject = [ '$scope' , 'CONSTANTS' , 'ProfileService' , '$state' , 'userProfile' , 'featuredSkills' , 'logger' , 'toaster' , 'MemberCertService' , '$q' ]
9
+ SkillPickerController . $inject = [ '$scope' , 'CONSTANTS' , 'ProfileService' , '$state' , 'userProfile' , 'featuredSkills' , 'logger' , 'toaster' , 'MemberCertService' , 'GroupService' , '$q' ]
10
10
11
- function SkillPickerController ( $scope , CONSTANTS , ProfileService , $state , userProfile , featuredSkills , logger , toaster , MemberCertService , $q ) {
11
+ function SkillPickerController ( $scope , CONSTANTS , ProfileService , $state , userProfile , featuredSkills , logger , toaster , MemberCertService , GroupService , $q ) {
12
12
var vm = this
13
13
vm . ASSET_PREFIX = CONSTANTS . ASSET_PREFIX
14
14
vm . IOS_PROGRAM_ID = parseInt ( CONSTANTS . SWIFT_PROGRAM_ID )
@@ -80,6 +80,13 @@ import _ from 'lodash'
80
80
dirty : true ,
81
81
display : true
82
82
}
83
+ vm . communities [ 'blockchain' ] = {
84
+ displayName : 'Blockchain' ,
85
+ programId : vm . BLOCKCHAIN_PROGRAM_ID ,
86
+ status : false ,
87
+ dirty : false ,
88
+ display : true
89
+ }
83
90
vm . communities [ 'ios' ] = {
84
91
displayName : 'iOS' ,
85
92
programId : vm . IOS_PROGRAM_ID ,
@@ -93,18 +100,11 @@ import _ from 'lodash'
93
100
status : false ,
94
101
dirty : false ,
95
102
display : true
96
- }
97
- vm . communities [ 'blockchain' ] = {
98
- displayName : 'Blockchain' ,
99
- programId : vm . PREDIX_PROGRAM_ID ,
100
- status : false ,
101
- dirty : false ,
102
- display : true
103
- }
103
+ }
104
104
_addWatchToCommunity ( vm . communities [ 'ios' ] )
105
- _addWatchToCommunity ( vm . communities [ 'predix' ] )
106
- _addWatchToCommunity ( vm . communities [ 'ibm_cognitive' ] )
107
105
_addWatchToCommunity ( vm . communities [ 'blockchain' ] )
106
+ _addWatchToCommunity ( vm . communities [ 'predix' ] )
107
+ _addWatchToCommunity ( vm . communities [ 'ibm_cognitive' ] )
108
108
}
109
109
110
110
/**
@@ -128,9 +128,10 @@ import _ from 'lodash'
128
128
function checkCommunityStatus ( ) {
129
129
var promises = [ ]
130
130
for ( var name in vm . communities ) {
131
- var community = vm . communities [ name ]
132
- promises . push ( MemberCertService . getMemberRegistration ( vm . userId , community . programId ) )
131
+ var community = vm . communities [ name ]
132
+ promises . push ( MemberCertService . getMemberRegistration ( vm . userId , community . programId ) )
133
133
}
134
+
134
135
vm . loadingCommunities = true
135
136
136
137
$q . all ( promises )
@@ -211,7 +212,11 @@ import _ from 'lodash'
211
212
var community = vm . communities [ communityName ]
212
213
if ( community . dirty === true ) {
213
214
if ( community . status === true ) {
214
- promises . push ( MemberCertService . registerMember ( vm . userId , community . programId ) )
215
+ if ( community . programId === vm . BLOCKCHAIN_PROGRAM_ID ) {
216
+ promises . push ( GroupService . rm ( vm . userId , community . programId ) )
217
+ } else {
218
+ promises . push ( MemberCertService . registerMember ( vm . userId , community . programId ) )
219
+ }
215
220
}
216
221
}
217
222
}
0 commit comments