File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export const system = {
23
23
deletePassport : authFirst ,
24
24
25
25
adminSalesloftSync : authFirst ,
26
+ userSalesloftSync : authFirst ,
26
27
} ;
27
28
28
29
export interface System {
@@ -103,6 +104,8 @@ export interface System {
103
104
account_ids : string [ ] ;
104
105
} ) => Promise < void > ;
105
106
107
+ userSalesloftSync : ( opts : { account_id ?: string } ) => Promise < void > ;
108
+
106
109
sendEmailVerification : ( opts : {
107
110
account_id ?: string ;
108
111
only_verify ?: boolean ;
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ export class AccountActions extends Actions<AccountState> {
245
245
this . setState ( { fragment } ) ;
246
246
} ;
247
247
248
- addTag = ( tag : string ) => {
248
+ addTag = async ( tag : string ) => {
249
249
const store = this . redux . getStore ( "account" ) ;
250
250
if ( ! store ) return ;
251
251
const tags = store . get ( "tags" ) ;
@@ -258,6 +258,15 @@ export class AccountActions extends Actions<AccountState> {
258
258
const v = tags ?. toJS ( ) ?? [ ] ;
259
259
v . push ( tag ) ;
260
260
table . set ( { tags : v } ) ;
261
+ try {
262
+ await webapp_client . conat_client . hub . system . userSalesloftSync ( { } ) ;
263
+ } catch ( err ) {
264
+ console . warn (
265
+ "WARNING: issue syncing with salesloft after setting tag" ,
266
+ tag ,
267
+ err ,
268
+ ) ;
269
+ }
261
270
} ;
262
271
263
272
// delete won't be visible in frontend until a browser refresh...
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import search from "@cocalc/server/accounts/search";
10
10
export { getNames } from "@cocalc/server/accounts/get-name" ;
11
11
import { callback2 } from "@cocalc/util/async-utils" ;
12
12
import getLogger from "@cocalc/backend/logger" ;
13
+ import { reuseInFlight } from "@cocalc/util/reuse-in-flight" ;
13
14
14
15
const logger = getLogger ( "server:conat:api:system" ) ;
15
16
@@ -154,3 +155,12 @@ export async function adminSalesloftSync({
154
155
}
155
156
} ) ( ) ;
156
157
}
158
+
159
+ // user can sync themself with salesloft.
160
+ export const userSalesloftSync = reuseInFlight (
161
+ async ( { account_id } : { account_id ?: string } ) : Promise < void > => {
162
+ if ( account_id ) {
163
+ await salesloftSync ( [ account_id ] ) ;
164
+ }
165
+ } ,
166
+ ) ;
You can’t perform that action at this time.
0 commit comments