@@ -1397,7 +1397,7 @@ const rootMutations = {
1397
1397
const [ deleteResult , insertResult ] = await Promise . all ( [
1398
1398
await r
1399
1399
. knex ( "campaign_contact_tag" )
1400
- . where ( { campaign_contact_id : campaignContactId } )
1400
+ . where ( { campaign_contact_id : parseInt ( campaignContactId ) } )
1401
1401
. whereIn ( "tag_id" , removedTagIds )
1402
1402
. del ( ) ,
1403
1403
await r . knex ( "campaign_contact_tag" ) . insert ( tagsToInsert )
@@ -1427,6 +1427,20 @@ const rootMutations = {
1427
1427
. then ( urls => urls . filter ( url => url . length > 0 ) ) ;
1428
1428
await notifyOnTagConversation ( campaignContactId , user . id , webhookUrls ) ;
1429
1429
1430
+ // See if any of the newly applied tags are is_assignable = false
1431
+ const newlyAssignedTagsThatShouldUnassign = await r
1432
+ . knex ( "tag" )
1433
+ . select ( "id" )
1434
+ . whereIn ( "id" , addedTagIds )
1435
+ . where ( { is_assignable : false } ) ;
1436
+
1437
+ if ( newlyAssignedTagsThatShouldUnassign . length > 0 ) {
1438
+ await r
1439
+ . knex ( "campaign_contact" )
1440
+ . update ( { assignment_id : null } )
1441
+ . where ( { id : parseInt ( campaignContactId ) } ) ;
1442
+ }
1443
+
1430
1444
return campaignContact ;
1431
1445
} ,
1432
1446
createOptOut : async (
@@ -1901,6 +1915,8 @@ const rootMutations = {
1901
1915
contactsFilter
1902
1916
) ;
1903
1917
1918
+ console . log ( campaignContactIdsToMessageIds ) ;
1919
+
1904
1920
if ( newTexterUserIds == null ) {
1905
1921
const campaignContactIdsToUnassign = campaignContactIdsToMessageIds . map (
1906
1922
( [ ccId , _ ] ) => ccId
0 commit comments