Skip to content

Commit 7703c1b

Browse files
sausage-toddJoan ReyeroUroš Maroltgarrrikkotua
authored
Merge missing commits from lfx-main into main (#1038)
Co-authored-by: Joan Reyero <[email protected]> Co-authored-by: Uroš Marolt <[email protected]> Co-authored-by: garrrikkotua <[email protected]>
1 parent 4df6804 commit 7703c1b

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

backend/src/database/repositories/segmentRepository.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ class SegmentRepository extends RepositoryBase<
467467
{
468468
replacements: {
469469
tenantId: this.currentTenant.id,
470-
name: `${criteria.filter?.name}%`,
470+
name: `%${criteria.filter?.name}%`,
471471
status: criteria.filter?.status,
472472
},
473473
type: QueryTypes.SELECT,
@@ -642,8 +642,10 @@ class SegmentRepository extends RepositoryBase<
642642
activityTypes.default = lodash.cloneDeep(DEFAULT_ACTIVITY_TYPE_SETTINGS)
643643
activityTypes.custom = {}
644644

645-
if (Object.keys(record.customActivityTypes).length > 0) {
646-
activityTypes.custom = record.customActivityTypes
645+
const customActivityTypes = record.customActivityTypes || {}
646+
647+
if (Object.keys(customActivityTypes).length > 0) {
648+
activityTypes.custom = customActivityTypes
647649
}
648650

649651
return activityTypes

backend/src/database/repositories/settingsRepository.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import _get from 'lodash/get'
22
import SequelizeRepository from './sequelizeRepository'
33
import AuditLogRepository from './auditLogRepository'
44
import { IRepositoryOptions } from './IRepositoryOptions'
5+
import SegmentService from '../../services/segmentService'
56

67
export default class SettingsRepository {
78
static async findOrCreateDefault(defaults, options: IRepositoryOptions) {
@@ -82,15 +83,11 @@ export default class SettingsRepository {
8283
return record
8384
}
8485

85-
let segment = null
86-
87-
if (options.currentSegments?.length > 0) {
88-
segment = SequelizeRepository.getStrictlySingleActiveSegment(options)
89-
}
86+
const activityTypes = await SegmentService.getTenantActivityTypes(options.currentSegments)
9087

9188
const settings = record.get({ plain: true })
9289

93-
settings.activityTypes = segment ? segment.activityTypes : null
90+
settings.activityTypes = activityTypes
9491
settings.slackWebHook = !!settings.slackWebHook
9592

9693
return settings

backend/src/serverless/dbOperations/operationsWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function bulkOperations(
8888
operation: string,
8989
records: Array<any>,
9090
options: IServiceOptions,
91-
fireCrowdWebhooks: boolean = true,
91+
fireCrowdWebhooks: boolean = false,
9292
): Promise<any> {
9393
switch (operation) {
9494
case Operations.UPDATE_MEMBERS:

backend/src/serverless/integrations/services/integrations/githubIntegrationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ export class GithubIntegrationService extends IntegrationServiceBase {
10181018
prNumber,
10191019
},
10201020
}
1021-
1021+
// create a new stream
10221022
await streamRepo.create(stream)
10231023

10241024
if (!isExistingRun) {

backend/src/serverless/microservices/nodejs/workerFactory.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable no-case-declarations */
2+
import { Edition } from '@crowd/types'
23
import { weeklyAnalyticsEmailsWorker } from './analytics/workers/weeklyAnalyticsEmailsWorker'
34
import {
45
AutomationMessage,
@@ -27,6 +28,7 @@ import { integrationDataCheckerWorker } from './integration-data-checker/integra
2728
import { refreshSampleDataWorker } from './integration-data-checker/refreshSampleDataWorker'
2829
import { mergeSuggestionsWorker } from './merge-suggestions/mergeSuggestionsWorker'
2930
import { BulkorganizationEnrichmentWorker } from './bulk-enrichment/bulkOrganizationEnrichmentWorker'
31+
import { API_CONFIG } from '../../../conf'
3032

3133
/**
3234
* Worker factory for spawning different microservices
@@ -77,6 +79,9 @@ async function workerFactory(event: NodeMicroserviceMessage): Promise<any> {
7779
}
7880

7981
case 'automation-process':
82+
if (API_CONFIG.edition === Edition.LFX) {
83+
return {}
84+
}
8085
const automationProcessRequest = event as ProcessAutomationMessage
8186

8287
switch (automationProcessRequest.automationType) {
@@ -103,6 +108,9 @@ async function workerFactory(event: NodeMicroserviceMessage): Promise<any> {
103108
}
104109

105110
case 'automation':
111+
if (API_CONFIG.edition === Edition.LFX) {
112+
return {}
113+
}
106114
const automationRequest = event as AutomationMessage
107115

108116
switch (automationRequest.trigger) {

backend/src/services/segmentService.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,19 +384,20 @@ export default class SegmentService extends LoggerBase {
384384
}
385385

386386
static async getTenantActivityTypes(subprojects: any) {
387-
return subprojects.reduce(
388-
(acc: any, subproject) => ({
387+
return subprojects.reduce((acc: any, subproject) => {
388+
const activityTypes = SegmentRepository.buildActivityTypes(subproject)
389+
390+
return {
389391
custom: {
390392
...acc.custom,
391-
...subproject.activityTypes.custom,
393+
...activityTypes.custom,
392394
},
393395
default: {
394396
...acc.default,
395-
...subproject.activityTypes.default,
397+
...activityTypes.default,
396398
},
397-
}),
398-
{},
399-
)
399+
}
400+
}, {})
400401
}
401402

402403
static async getTenantActivityChannels(subprojects: any) {

0 commit comments

Comments
 (0)