Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add change request events to teams integration #9309

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/lib/addons/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ import {
import type { IEvent } from '../types/events';
import type { IntegrationEventState } from '../features/integration-events/integration-events-store';

import {
CHANGE_ADDED,
CHANGE_DISCARDED,
CHANGE_EDITED,
CHANGE_REQUEST_APPLIED,
CHANGE_REQUEST_APPROVAL_ADDED,
CHANGE_REQUEST_APPROVED,
CHANGE_REQUEST_CANCELLED,
CHANGE_REQUEST_CREATED,
CHANGE_REQUEST_DISCARDED,
CHANGE_REQUEST_REJECTED,
CHANGE_REQUEST_SENT_TO_REVIEW,
CHANGE_REQUEST_SCHEDULED,
CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS,
CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE,
CHANGE_REQUEST_SCHEDULE_SUSPENDED,
} from '../types/events';

interface ITeamsParameters {
url: string;
customHeaders?: string;
Expand All @@ -23,6 +41,26 @@ export default class TeamsAddon extends Addon {
flagResolver: IFlagResolver;

constructor(args: IAddonConfig) {
if (args.flagResolver.isEnabled('teamsIntegrationChangeRequests')) {
teamsDefinition.events = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place the teamsDefinition is used yeah?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checked: Yes.

...teamsDefinition.events!,
CHANGE_ADDED,
CHANGE_DISCARDED,
CHANGE_EDITED,
CHANGE_REQUEST_APPLIED,
CHANGE_REQUEST_APPROVAL_ADDED,
CHANGE_REQUEST_APPROVED,
CHANGE_REQUEST_CANCELLED,
CHANGE_REQUEST_CREATED,
CHANGE_REQUEST_DISCARDED,
CHANGE_REQUEST_REJECTED,
CHANGE_REQUEST_SENT_TO_REVIEW,
CHANGE_REQUEST_SCHEDULED,
CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS,
CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE,
CHANGE_REQUEST_SCHEDULE_SUSPENDED,
];
}
super(teamsDefinition, args);
this.msgFormatter = new FeatureEventFormatterMd({
unleashUrl: args.unleashUrl,
Expand Down
7 changes: 6 additions & 1 deletion src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export type IFlagKey =
| 'frontendHeaderRedesign'
| 'dataUsageMultiMonthView'
| 'uiGlobalFontSize'
| 'connectionCount';
| 'connectionCount'
| 'teamsIntegrationChangeRequests';

export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;

Expand Down Expand Up @@ -319,6 +320,10 @@ const flags: IFlags = {
process.env.EXPERIMENTAL_CONNECTION_COUNT,
false,
),
teamsIntegrationChangeRequests: parseEnvVarBoolean(
process.env.EXPERIMENTAL_TEAMS_INTEGRATION_CHANGE_REQUESTS,
false,
),
};

export const defaultExperimentalOptions: IExperimentalOptions = {
Expand Down
1 change: 1 addition & 0 deletions src/server-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ process.nextTick(async () => {
dataUsageMultiMonthView: true,
filterExistingFlagNames: true,
uiGlobalFontSize: true,
teamsIntegrationChangeRequests: true,
},
},
authentication: {
Expand Down