diff --git a/src/lib/addons/__snapshots__/datadog.test.ts.snap b/src/lib/addons/__snapshots__/datadog.test.ts.snap index 2480612ff011..239587319710 100644 --- a/src/lib/addons/__snapshots__/datadog.test.ts.snap +++ b/src/lib/addons/__snapshots__/datadog.test.ts.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Datadog integration Should call datadog webhook for archived toggle 1`] = `"{"text":"%%% \\n **some@user.com** archived **some-toggle** in project **** \\n %%% ","title":"Unleash notification update"}"`; +exports[`Datadog integration Should call datadog webhook for archived toggle 1`] = `"{"text":"%%% \\n *some@user.com* archived *some-toggle* in project ** \\n %%% ","title":"Unleash notification update"}"`; -exports[`Datadog integration Should call datadog webhook for archived toggle with project info 1`] = `"{"text":"%%% \\n **some@user.com** archived **some-toggle** in project **[some-project](http://some-url.com/projects/some-project)** \\n %%% ","title":"Unleash notification update"}"`; +exports[`Datadog integration Should call datadog webhook for archived toggle with project info 1`] = `"{"text":"%%% \\n *some@user.com* archived *some-toggle* in project *[some-project](http://some-url.com/projects/some-project)* \\n %%% ","title":"Unleash notification update"}"`; -exports[`Datadog integration Should call datadog webhook 1`] = `"{"text":"%%% \\n **some@user.com** created **[some-toggle](http://some-url.com/projects//features/some-toggle)** in project **** \\n %%% ","title":"Unleash notification update"}"`; +exports[`Datadog integration Should call datadog webhook 1`] = `"{"text":"%%% \\n *some@user.com* created *[some-toggle](http://some-url.com/projects//features/some-toggle)* in project ** \\n %%% ","title":"Unleash notification update"}"`; -exports[`Datadog integration Should call datadog webhook for toggled environment 1`] = `"{"text":"%%% \\n **some@user.com** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)** \\n %%% ","title":"Unleash notification update"}"`; +exports[`Datadog integration Should call datadog webhook for toggled environment 1`] = `"{"text":"%%% \\n *some@user.com* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)* \\n %%% ","title":"Unleash notification update"}"`; exports[`Datadog integration Should call datadog webhook with JSON when template set 1`] = `"{"text":"{\\n \\"event\\": \\"feature-created\\",\\n \\"createdBy\\": \\"some@user.com\\"\\n}","title":"Unleash notification update"}"`; -exports[`Datadog integration Should include customHeaders in headers when calling service 1`] = `"{"text":"%%% \\n **some@user.com** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)** \\n %%% ","title":"Unleash notification update"}"`; +exports[`Datadog integration Should include customHeaders in headers when calling service 1`] = `"{"text":"%%% \\n *some@user.com* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)* \\n %%% ","title":"Unleash notification update"}"`; exports[`Datadog integration Should include customHeaders in headers when calling service 2`] = ` { @@ -20,7 +20,7 @@ exports[`Datadog integration Should include customHeaders in headers when callin } `; -exports[`Datadog integration Should not include source_type_name when included in the config 1`] = `"{"text":"%%% \\n **some@user.com** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)** \\n %%% ","title":"Unleash notification update","source_type_name":"my-custom-source-type"}"`; +exports[`Datadog integration Should not include source_type_name when included in the config 1`] = `"{"text":"%%% \\n *some@user.com* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)* \\n %%% ","title":"Unleash notification update","source_type_name":"my-custom-source-type"}"`; exports[`Datadog integration Should not include source_type_name when included in the config 2`] = ` { diff --git a/src/lib/addons/__snapshots__/feature-event-formatter-md.test.ts.snap b/src/lib/addons/__snapshots__/feature-event-formatter-md.test.ts.snap index 280dfcc9c9f1..8ce76de74664 100644 --- a/src/lib/addons/__snapshots__/feature-event-formatter-md.test.ts.snap +++ b/src/lib/addons/__snapshots__/feature-event-formatter-md.test.ts.snap @@ -3,7 +3,7 @@ exports[`Should format specialised text for events when IPs changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **remoteAddress** in **production** IPs from empty set of IPs to [127.0.0.1]; constraints from empty set of constraints to [appName is one of (x,y)]", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *remoteAddress* in *production* IPs from empty set of IPs to [127.0.0.1]; constraints from empty set of constraints to [appName is one of (x,y)]", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -11,7 +11,7 @@ exports[`Should format specialised text for events when IPs changed 1`] = ` exports[`Should format specialised text for events when a scheduled change request is suspended 1`] = ` { "label": "Change request suspended", - "text": "Change request **[#1](unleashUrl/projects/my-other-project/change-requests/1)** in the **production** environment in project **[my-other-project](unleashUrl/projects/my-other-project)** was suspended for the following reason: The user who scheduled this change request (user id: 6) has been deleted from this Unleash instance.", + "text": "Change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* in the *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* was suspended for the following reason: The user who scheduled this change request (user id: 6) has been deleted from this Unleash instance.", "url": "unleashUrl/projects/my-other-project/change-requests/1", } `; @@ -19,7 +19,7 @@ exports[`Should format specialised text for events when a scheduled change reque exports[`Should format specialised text for events when change request is scheduled 1`] = ` { "label": "Change request scheduled", - "text": "**user@company.com** scheduled change request **[#1](unleashUrl/projects/my-other-project/change-requests/1)** for feature flag **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in the **production** environment in project **[my-other-project](unleashUrl/projects/my-other-project)** to be applied at in project **my-other-project**", + "text": "*user@company.com* scheduled change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* for feature flag *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in the *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* to be applied at in project *my-other-project*", "url": "unleashUrl/projects/my-other-project/change-requests/1", } `; @@ -27,7 +27,7 @@ exports[`Should format specialised text for events when change request is schedu exports[`Should format specialised text for events when constraints and rollout percentage and stickiness changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **flexibleRollout** in **production** stickiness from default to random; rollout from 67% to 32%; constraints from empty set of constraints to [appName is one of (x,y)]", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production* stickiness from default to random; rollout from 67% to 32%; constraints from empty set of constraints to [appName is one of (x,y)]", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -35,7 +35,7 @@ exports[`Should format specialised text for events when constraints and rollout exports[`Should format specialised text for events when default strategy updated 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from empty set of constraints to [appName is one of (x,y), appName not is one of (x)]", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from empty set of constraints to [appName is one of (x,y), appName not is one of (x)]", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -43,7 +43,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated 2`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from empty set of constraints to [appName is not one of (x,y), appName not is not one of (x)]", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from empty set of constraints to [appName is not one of (x,y), appName not is not one of (x)]", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -51,7 +51,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated 3`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from empty set of constraints to [appName is a string that contains (x,y), appName not is a string that contains (x)]", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from empty set of constraints to [appName is a string that contains (x,y), appName not is a string that contains (x)]", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -59,7 +59,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated 4`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from empty set of constraints to [appName is a string that starts with (x,y), appName not is a string that starts with (x)]", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from empty set of constraints to [appName is a string that starts with (x,y), appName not is a string that starts with (x)]", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -67,7 +67,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated 5`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from empty set of constraints to [appName is a string that ends with (x,y), appName not is a string that ends with (x)]", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from empty set of constraints to [appName is a string that ends with (x,y), appName not is a string that ends with (x)]", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -75,7 +75,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint DATE_AFTER 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a date after 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a date after 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -83,7 +83,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint DATE_BEFORE 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a date before 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a date before 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -91,7 +91,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint NUM_EQ 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a number equal to 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a number equal to 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -99,7 +99,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint NUM_GT 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a number greater than 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a number greater than 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -107,7 +107,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint NUM_GTE 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a number greater than or equal to 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a number greater than or equal to 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -115,7 +115,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint NUM_LT 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a number less than 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a number less than 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -123,7 +123,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint NUM_LTE 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a number less than or equal to 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a number less than or equal to 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -131,7 +131,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint SEMVER_EQ 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a SemVer equal to 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a SemVer equal to 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -139,7 +139,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint SEMVER_GT 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a SemVer greater than 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a SemVer greater than 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -147,7 +147,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when default strategy updated with numeric constraint SEMVER_LT 1`] = ` { "label": "Flag strategy updated", - "text": "**admin** updated **[aaa](unleashUrl/projects/default/features/aaa)** in project **[default](unleashUrl/projects/default)** by updating strategy **default** in **production** constraints from [appName is a SemVer less than 4] to empty set of constraints", + "text": "*admin* updated *[aaa](unleashUrl/projects/default/features/aaa)* in project *[default](unleashUrl/projects/default)* by updating strategy *default* in *production* constraints from [appName is a SemVer less than 4] to empty set of constraints", "url": "unleashUrl/projects/default/features/aaa", } `; @@ -155,7 +155,7 @@ exports[`Should format specialised text for events when default strategy updated exports[`Should format specialised text for events when groupId changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **flexibleRollout** in **production** groupId from new-feature to different-feature", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production* groupId from new-feature to different-feature", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -163,7 +163,7 @@ exports[`Should format specialised text for events when groupId changed 1`] = ` exports[`Should format specialised text for events when host names changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **applicationHostname** in **production** hostNames from empty set of hostNames to [unleash.com]; constraints from empty set of constraints to [appName is one of (x,y)]", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *applicationHostname* in *production* hostNames from empty set of hostNames to [unleash.com]; constraints from empty set of constraints to [appName is one of (x,y)]", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -171,7 +171,7 @@ exports[`Should format specialised text for events when host names changed 1`] = exports[`Should format specialised text for events when neither rollout percentage nor stickiness changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **flexibleRollout** in **production**", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production*", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -179,7 +179,7 @@ exports[`Should format specialised text for events when neither rollout percenta exports[`Should format specialised text for events when no specific text for strategy exists yet 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **newStrategy** in **production**", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *newStrategy* in *production*", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -187,7 +187,7 @@ exports[`Should format specialised text for events when no specific text for str exports[`Should format specialised text for events when rollout percentage changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **flexibleRollout** in **production** rollout from 67% to 32%", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production* rollout from 67% to 32%", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -195,7 +195,7 @@ exports[`Should format specialised text for events when rollout percentage chang exports[`Should format specialised text for events when scheduled change request fails 1`] = ` { "label": "Scheduled change request failed", - "text": "**Failed** to apply the scheduled change request **[#1](unleashUrl/projects/my-other-project/change-requests/1)** for feature flag **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in the **production** environment in project **[my-other-project](unleashUrl/projects/my-other-project)** by **user@company.com** in project **my-other-project**.", + "text": "*Failed* to apply the scheduled change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* for feature flag *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in the *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* by *user@company.com* in project *my-other-project*.", "url": "unleashUrl/projects/my-other-project/change-requests/1", } `; @@ -203,7 +203,7 @@ exports[`Should format specialised text for events when scheduled change request exports[`Should format specialised text for events when scheduled change request succeeds 1`] = ` { "label": "Scheduled change request applied successfully", - "text": "**Successfully** applied the scheduled change request **[#1](unleashUrl/projects/my-other-project/change-requests/1)** for feature flag **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in the **production** environment in project **[my-other-project](unleashUrl/projects/my-other-project)** by **user@company.com** in project **my-other-project**.", + "text": "*Successfully* applied the scheduled change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* for feature flag *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in the *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* by *user@company.com* in project *my-other-project*.", "url": "unleashUrl/projects/my-other-project/change-requests/1", } `; @@ -211,7 +211,7 @@ exports[`Should format specialised text for events when scheduled change request exports[`Should format specialised text for events when stickiness changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **flexibleRollout** in **production** stickiness from default to random", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production* stickiness from default to random", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -219,7 +219,7 @@ exports[`Should format specialised text for events when stickiness changed 1`] = exports[`Should format specialised text for events when strategy added 1`] = ` { "label": "Flag strategy added", - "text": "**user@company.com** added strategy **flexibleRollout** to **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** for the **production** environment in project **[my-other-project](unleashUrl/projects/my-other-project)**", + "text": "*user@company.com* added strategy *flexibleRollout* to *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* for the *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)*", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -227,7 +227,7 @@ exports[`Should format specialised text for events when strategy added 1`] = ` exports[`Should format specialised text for events when strategy removed 1`] = ` { "label": "Flag strategy removed", - "text": "**user@company.com** removed strategy **default** from **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** for the **production** environment in project **[my-other-project](unleashUrl/projects/my-other-project)**", + "text": "*user@company.com* removed strategy *default* from *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* for the *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)*", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; @@ -235,7 +235,7 @@ exports[`Should format specialised text for events when strategy removed 1`] = ` exports[`Should format specialised text for events when userIds changed 1`] = ` { "label": "Flag strategy updated", - "text": "**user@company.com** updated **[new-feature](unleashUrl/projects/my-other-project/features/new-feature)** in project **[my-other-project](unleashUrl/projects/my-other-project)** by updating strategy **userWithId** in **production** userIds from empty set of userIds to [a,b]; constraints from empty set of constraints to [appName is one of (x,y)]", + "text": "*user@company.com* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *userWithId* in *production* userIds from empty set of userIds to [a,b]; constraints from empty set of constraints to [appName is one of (x,y)]", "url": "unleashUrl/projects/my-other-project/features/new-feature", } `; diff --git a/src/lib/addons/__snapshots__/slack.test.ts.snap b/src/lib/addons/__snapshots__/slack.test.ts.snap index e30b99792a93..5a38efeaa1d9 100644 --- a/src/lib/addons/__snapshots__/slack.test.ts.snap +++ b/src/lib/addons/__snapshots__/slack.test.ts.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Slack integration Should call slack webhook 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**some@user.com** created **** in project ****","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; +exports[`Slack integration Should call slack webhook 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*some@user.com* created ** in project **","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; -exports[`Slack integration Should call slack webhook for archived toggle 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**some@user.com** archived **some-toggle** in project ****","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects//archive"}]}]}"`; +exports[`Slack integration Should call slack webhook for archived toggle 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*some@user.com* archived *some-toggle* in project **","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects//archive"}]}]}"`; -exports[`Slack integration Should call slack webhook for archived toggle with project info 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**some@user.com** archived **some-toggle** in project ****","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/some-project/archive"}]}]}"`; +exports[`Slack integration Should call slack webhook for archived toggle with project info 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*some@user.com* archived *some-toggle* in project **","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/some-project/archive"}]}]}"`; -exports[`Slack integration Should call webhook for toggled environment 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**some@user.com** disabled **** for the **development** environment in project ****","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; +exports[`Slack integration Should call webhook for toggled environment 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*some@user.com* disabled ** for the *development* environment in project **","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; -exports[`Slack integration Should include custom headers from parameters in call to service 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**some@user.com** disabled **** for the **development** environment in project ****","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; +exports[`Slack integration Should include custom headers from parameters in call to service 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*some@user.com* disabled ** for the *development* environment in project **","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; exports[`Slack integration Should include custom headers from parameters in call to service 2`] = ` { diff --git a/src/lib/addons/__snapshots__/teams.test.ts.snap b/src/lib/addons/__snapshots__/teams.test.ts.snap index 042fc10b98d1..fe2875686a00 100644 --- a/src/lib/addons/__snapshots__/teams.test.ts.snap +++ b/src/lib/addons/__snapshots__/teams.test.ts.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Teams integration Should call teams webhook 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**some@user.com** created **[some-toggle](http://some-url.com/projects//features/some-toggle)** in project ****","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-created"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//features/some-toggle"}]}]}"`; +exports[`Teams integration Should call teams webhook 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*some@user.com* created *[some-toggle](http://some-url.com/projects//features/some-toggle)* in project **","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-created"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//features/some-toggle"}]}]}"`; -exports[`Teams integration Should call teams webhook for archived toggle 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**some@user.com** archived **some-toggle** in project ****","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//archive"}]}]}"`; +exports[`Teams integration Should call teams webhook for archived toggle 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*some@user.com* archived *some-toggle* in project **","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//archive"}]}]}"`; -exports[`Teams integration Should call teams webhook for archived toggle with project info 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**some@user.com** archived **some-toggle** in project **[some-project](http://some-url.com/projects/some-project)**","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/some-project/archive"}]}]}"`; +exports[`Teams integration Should call teams webhook for archived toggle with project info 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*some@user.com* archived *some-toggle* in project *[some-project](http://some-url.com/projects/some-project)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/some-project/archive"}]}]}"`; -exports[`Teams integration Should call teams webhook for toggled environment 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**some@user.com** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)**","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; +exports[`Teams integration Should call teams webhook for toggled environment 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*some@user.com* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; -exports[`Teams integration Should include custom headers in call to teams 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**some@user.com** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)**","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; +exports[`Teams integration Should include custom headers in call to teams 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*some@user.com* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; exports[`Teams integration Should include custom headers in call to teams 2`] = ` { diff --git a/src/lib/addons/__snapshots__/webhook.test.ts.snap b/src/lib/addons/__snapshots__/webhook.test.ts.snap index 584ee428f757..59d357fd9358 100644 --- a/src/lib/addons/__snapshots__/webhook.test.ts.snap +++ b/src/lib/addons/__snapshots__/webhook.test.ts.snap @@ -3,6 +3,6 @@ exports[`Webhook integration should allow for eventJson and eventMarkdown in bodyTemplate 1`] = ` "{ "json": "{\\"id\\":1,\\"createdAt\\":\\"2024-07-24T00:00:00.000Z\\",\\"createdByUserId\\":-1337,\\"type\\":\\"feature-created\\",\\"createdBy\\":\\"some@user.com\\",\\"featureName\\":\\"some-toggle\\",\\"project\\":\\"default\\",\\"data\\":{\\"name\\":\\"some-toggle\\",\\"enabled\\":false,\\"strategies\\":[{\\"name\\":\\"default\\"}]}}", - "markdown": "**some@user.com** created **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** in project **[default](http://some-url.com/projects/default)**" + "markdown": "*some@user.com* created *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* in project *[default](http://some-url.com/projects/default)*" }" `; diff --git a/src/lib/addons/feature-event-formatter-md.ts b/src/lib/addons/feature-event-formatter-md.ts index 209c3655d9ce..09015e2df516 100644 --- a/src/lib/addons/feature-event-formatter-md.ts +++ b/src/lib/addons/feature-event-formatter-md.ts @@ -82,297 +82,295 @@ export enum LinkStyle { MD = 1, } -export const bold = (text?: string) => (text ? `**${text}**` : ''); - const EVENT_MAP: Record = { [ADDON_CONFIG_CREATED]: { label: 'Integration configuration created', - action: `${bold('{{user}}')} created a new ${bold('{{event.data.provider}}')} integration configuration`, + action: '*{{user}}* created a new *{{event.data.provider}}* integration configuration', path: '/integrations', }, [ADDON_CONFIG_DELETED]: { label: 'Integration configuration deleted', - action: `${bold('{{user}}')} deleted a ${bold('{{event.preData.provider}}')} integration configuration`, + action: '*{{user}}* deleted a *{{event.preData.provider}}* integration configuration', path: '/integrations', }, [ADDON_CONFIG_UPDATED]: { label: 'Integration configuration updated', - action: `${bold('{{user}}')} updated a ${bold('{{event.preData.provider}}')} integration configuration`, + action: '*{{user}}* updated a *{{event.preData.provider}}* integration configuration', path: '/integrations', }, [API_TOKEN_CREATED]: { label: 'API token created', - action: `${bold('{{user}}')} created API token ${bold('{{event.data.username}}')}`, + action: '*{{user}}* created API token *{{event.data.username}}*', path: '/admin/api', }, [API_TOKEN_DELETED]: { label: 'API token deleted', - action: `${bold('{{user}}')} deleted API token ${bold('{{event.preData.username}}')}`, + action: '*{{user}}* deleted API token *{{event.preData.username}}*', path: '/admin/api', }, [CHANGE_ADDED]: { label: 'Change added', - action: `${bold('{{user}}')} added a change to change request {{changeRequest}}`, + action: '*{{user}}* added a change to change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_DISCARDED]: { label: 'Change discarded', - action: `${bold('{{user}}')} discarded a change in change request {{changeRequest}}`, + action: '*{{user}}* discarded a change in change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_EDITED]: { label: 'Change edited', - action: `${bold('{{user}}')} edited a change in change request {{changeRequest}}`, + action: '*{{user}}* edited a change in change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_APPLIED]: { label: 'Change request applied', - action: `${bold('{{user}}')} applied change request {{changeRequest}}`, + action: '*{{user}}* applied change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_APPROVAL_ADDED]: { label: 'Change request approval added', - action: `${bold('{{user}}')} added an approval to change request {{changeRequest}}`, + action: '*{{user}}* added an approval to change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_APPROVED]: { label: 'Change request approved', - action: `${bold('{{user}}')} approved change request {{changeRequest}}`, + action: '*{{user}}* approved change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_CANCELLED]: { label: 'Change request cancelled', - action: `${bold('{{user}}')} cancelled change request {{changeRequest}}`, + action: '*{{user}}* cancelled change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_CREATED]: { label: 'Change request created', - action: `${bold('{{user}}')} created change request {{changeRequest}}`, + action: '*{{user}}* created change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_DISCARDED]: { label: 'Change request discarded', - action: `${bold('{{user}}')} discarded change request {{changeRequest}}`, + action: '*{{user}}* discarded change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_REJECTED]: { label: 'Change request rejected', - action: `${bold('{{user}}')} rejected change request {{changeRequest}}`, + action: '*{{user}}* rejected change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_SENT_TO_REVIEW]: { label: 'Change request sent to review', - action: `${bold('{{user}}')} sent to review change request {{changeRequest}}`, + action: '*{{user}}* sent to review change request {{changeRequest}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_SCHEDULED]: { label: 'Change request scheduled', - action: `${bold('{{user}}')} scheduled change request {{changeRequest}} to be applied at {{event.data.scheduledDate}} in project ${bold('{{event.project}}')}`, + action: '*{{user}}* scheduled change request {{changeRequest}} to be applied at {{event.data.scheduledDate}} in project *{{event.project}}*', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS]: { label: 'Scheduled change request applied successfully', - action: `${bold('Successfully')} applied the scheduled change request {{changeRequest}} by ${bold('{{user}}')} in project ${bold('{{event.project}}')}.`, + action: '*Successfully* applied the scheduled change request {{changeRequest}} by *{{user}}* in project *{{event.project}}*.', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE]: { label: 'Scheduled change request failed', - action: `${bold('Failed')} to apply the scheduled change request {{changeRequest}} by ${bold('{{user}}')} in project ${bold('{{event.project}}')}.`, + action: '*Failed* to apply the scheduled change request {{changeRequest}} by *{{user}}* in project *{{event.project}}*.', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CHANGE_REQUEST_SCHEDULE_SUSPENDED]: { label: 'Change request suspended', - action: `Change request {{changeRequest}} was suspended for the following reason: {{event.data.reason}}`, + action: 'Change request {{changeRequest}} was suspended for the following reason: {{event.data.reason}}', path: '/projects/{{event.project}}/change-requests/{{event.data.changeRequestId}}', }, [CONTEXT_FIELD_CREATED]: { label: 'Context field created', - action: `${bold('{{user}}')} created context field ${bold('{{event.data.name}}')}`, + action: '*{{user}}* created context field *{{event.data.name}}*', path: '/context', }, [CONTEXT_FIELD_DELETED]: { label: 'Context field deleted', - action: `${bold('{{user}}')} deleted context field ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* deleted context field *{{event.preData.name}}*', path: '/context', }, [CONTEXT_FIELD_UPDATED]: { label: 'Context field updated', - action: `${bold('{{user}}')} updated context field ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* updated context field *{{event.preData.name}}*', path: '/context', }, [FEATURE_ARCHIVED]: { label: 'Flag archived', - action: `${bold('{{user}}')} archived ${bold('{{event.featureName}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* archived *{{event.featureName}}* in project *{{project}}*', path: '/projects/{{event.project}}/archive', }, [FEATURE_CREATED]: { label: 'Flag created', - action: `${bold('{{user}}')} created ${bold('{{feature}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* created *{{feature}}* in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_DELETED]: { label: 'Flag deleted', - action: `${bold('{{user}}')} deleted ${bold('{{event.featureName}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* deleted *{{event.featureName}}* in project *{{project}}*', path: '/projects/{{event.project}}', }, [FEATURE_ENVIRONMENT_DISABLED]: { label: 'Flag disabled', - action: `${bold('{{user}}')} disabled ${bold('{{feature}}')} for the ${bold('{{event.environment}}')} environment in project ${bold('{{project}}')}`, + action: '*{{user}}* disabled *{{feature}}* for the *{{event.environment}}* environment in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_ENVIRONMENT_ENABLED]: { label: 'Flag enabled', - action: `${bold('{{user}}')} enabled ${bold('{{feature}}')} for the ${bold('{{event.environment}}')} environment in project ${bold('{{project}}')}`, + action: '*{{user}}* enabled *{{feature}}* for the *{{event.environment}}* environment in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_ENVIRONMENT_VARIANTS_UPDATED]: { label: 'Flag variants updated', - action: `${bold('{{user}}')} updated variants for ${bold('{{feature}}')} for the ${bold('{{event.environment}}')} environment in project ${bold('{{project}}')}`, + action: '*{{user}}* updated variants for *{{feature}}* for the *{{event.environment}}* environment in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}/variants', }, [FEATURE_METADATA_UPDATED]: { label: 'Flag metadata updated', - action: `${bold('{{user}}')} updated ${bold('{{feature}}')} metadata in project ${bold('{{project}}')}`, + action: '*{{user}}* updated *{{feature}}* metadata in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_COMPLETED]: { label: 'Flag marked as completed', - action: `${bold('{{feature}}')} was marked as completed in project ${bold('{{project}}')}`, + action: '*{{feature}}* was marked as completed in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_POTENTIALLY_STALE_ON]: { label: 'Flag potentially stale', - action: `${bold('{{feature}}')} was marked as potentially stale in project ${bold('{{project}}')}`, + action: '*{{feature}}* was marked as potentially stale in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_PROJECT_CHANGE]: { label: 'Flag moved to a new project', - action: `${bold('{{user}}')} moved ${bold('{{feature}}')} from ${bold('{{event.data.oldProject}}')} to ${bold('{{project}}')}`, + action: '*{{user}}* moved *{{feature}}* from *{{event.data.oldProject}}* to *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_REVIVED]: { label: 'Flag revived', - action: `${bold('{{user}}')} revived ${bold('{{feature}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* revived *{{feature}}* in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_STALE_OFF]: { label: 'Flag stale marking removed', - action: `${bold('{{user}}')} removed the stale marking on ${bold('{{feature}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* removed the stale marking on *{{feature}}* in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_STALE_ON]: { label: 'Flag marked as stale', - action: `${bold('{{user}}')} marked ${bold('{{feature}}')} as stale in project ${bold('{{project}}')}`, + action: '*{{user}}* marked *{{feature}}* as stale in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_STRATEGY_ADD]: { label: 'Flag strategy added', - action: `${bold('{{user}}')} added strategy ${bold('{{strategyTitle}}')} to ${bold('{{feature}}')} for the ${bold('{{event.environment}}')} environment in project ${bold('{{project}}')}`, + action: '*{{user}}* added strategy *{{strategyTitle}}* to *{{feature}}* for the *{{event.environment}}* environment in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_STRATEGY_REMOVE]: { label: 'Flag strategy removed', - action: `${bold('{{user}}')} removed strategy ${bold('{{strategyTitle}}')} from ${bold('{{feature}}')} for the ${bold('{{event.environment}}')} environment in project ${bold('{{project}}')}`, + action: '*{{user}}* removed strategy *{{strategyTitle}}* from *{{feature}}* for the *{{event.environment}}* environment in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_STRATEGY_UPDATE]: { label: 'Flag strategy updated', - action: `${bold('{{user}}')} updated ${bold('{{feature}}')} in project ${bold('{{project}}')} {{strategyChangeText}}`, + action: '*{{user}}* updated *{{feature}}* in project *{{project}}* {{strategyChangeText}}', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_TAGGED]: { label: 'Flag tagged', - action: `${bold('{{user}}')} tagged ${bold('{{feature}}')} with ${bold('{{event.data.type}}:{{event.data.value}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* tagged *{{feature}}* with *{{event.data.type}}:{{event.data.value}}* in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [FEATURE_UNTAGGED]: { label: 'Flag untagged', - action: `${bold('{{user}}')} untagged ${bold('{{feature}}')} with ${bold('{{event.preData.type}}:{{event.preData.value}}')} in project ${bold('{{project}}')}`, + action: '*{{user}}* untagged *{{feature}}* with *{{event.preData.type}}:{{event.preData.value}}* in project *{{project}}*', path: '/projects/{{event.project}}/features/{{event.featureName}}', }, [GROUP_CREATED]: { label: 'Group created', - action: `${bold('{{user}}')} created group ${bold('{{event.data.name}}')}`, + action: '*{{user}}* created group *{{event.data.name}}*', path: '/admin/groups', }, [GROUP_DELETED]: { label: 'Group deleted', - action: `${bold('{{user}}')} deleted group ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* deleted group *{{event.preData.name}}*', path: '/admin/groups', }, [GROUP_UPDATED]: { label: 'Group updated', - action: `${bold('{{user}}')} updated group ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* updated group *{{event.preData.name}}*', path: '/admin/groups', }, [BANNER_CREATED]: { label: 'Banner created', - action: `${bold('{{user}}')} created banner ${bold('{{event.data.message}}')}`, + action: '*{{user}}* created banner *{{event.data.message}}*', path: '/admin/message-banners', }, [BANNER_DELETED]: { label: 'Banner deleted', - action: `${bold('{{user}}')} deleted banner ${bold('{{event.preData.message}}')}`, + action: '*{{user}}* deleted banner *{{event.preData.message}}*', path: '/admin/message-banners', }, [BANNER_UPDATED]: { label: 'Banner updated', - action: `${bold('{{user}}')} updated banner ${bold('{{event.preData.message}}')}`, + action: '*{{user}}* updated banner *{{event.preData.message}}*', path: '/admin/message-banners', }, [PROJECT_CREATED]: { label: 'Project created', - action: `${bold('{{user}}')} created project ${bold('{{project}}')}`, + action: '*{{user}}* created project *{{project}}*', path: '/projects', }, [PROJECT_DELETED]: { label: 'Project deleted', - action: `${bold('{{user}}')} deleted project ${bold('{{event.project}}')}`, + action: '*{{user}}* deleted project *{{event.project}}*', path: '/projects', }, [SEGMENT_CREATED]: { label: 'Segment created', - action: `${bold('{{user}}')} created segment ${bold('{{event.data.name}}')}`, + action: '*{{user}}* created segment *{{event.data.name}}*', path: '/segments', }, [SEGMENT_DELETED]: { label: 'Segment deleted', - action: `${bold('{{user}}')} deleted segment ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* deleted segment *{{event.preData.name}}*', path: '/segments', }, [SEGMENT_UPDATED]: { label: 'Segment updated', - action: `${bold('{{user}}')} updated segment ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* updated segment *{{event.preData.name}}*', path: '/segments', }, [SERVICE_ACCOUNT_CREATED]: { label: 'Service account created', - action: `${bold('{{user}}')} created service account ${bold('{{event.data.name}}')}`, + action: '*{{user}}* created service account *{{event.data.name}}*', path: '/admin/service-accounts', }, [SERVICE_ACCOUNT_DELETED]: { label: 'Service account deleted', - action: `${bold('{{user}}')} deleted service account ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* deleted service account *{{event.preData.name}}*', path: '/admin/service-accounts', }, [SERVICE_ACCOUNT_UPDATED]: { label: 'Service account updated', - action: `${bold('{{user}}')} updated service account ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* updated service account *{{event.preData.name}}*', path: '/admin/service-accounts', }, [USER_CREATED]: { label: 'User created', - action: `${bold('{{user}}')} created user ${bold('{{event.data.name}}')}`, + action: '*{{user}}* created user *{{event.data.name}}*', path: '/admin/users', }, [USER_DELETED]: { label: 'User deleted', - action: `${bold('{{user}}')} deleted user ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* deleted user *{{event.preData.name}}*', path: '/admin/users', }, [USER_UPDATED]: { label: 'User updated', - action: `${bold('{{user}}')} updated user ${bold('{{event.preData.name}}')}`, + action: '*{{user}}* updated user *{{event.preData.name}}*', path: '/admin/users', }, }; @@ -396,19 +394,17 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter { const text = `#${changeRequestId}`; const featureLink = this.generateFeatureLink(event); const featureText = featureLink - ? ` for feature flag ${bold(featureLink)}` + ? ` for feature flag *${featureLink}*` : ''; const environmentText = environment - ? ` in the ${bold(environment)} environment` + ? ` in the *${environment}* environment` : ''; const projectLink = this.generateProjectLink(event); - const projectText = project - ? ` in project ${bold(projectLink)}` - : ''; + const projectText = project ? ` in project *${projectLink}*` : ''; if (this.linkStyle === LinkStyle.SLACK) { - return `${bold(`<${url}|${text}>`)}${featureText}${environmentText}${projectText}`; + return `*<${url}|${text}>*${featureText}${environmentText}${projectText}`; } else { - return `${bold(`[${text}](${url})`)}${featureText}${environmentText}${projectText}`; + return `*[${text}](${url})*${featureText}${environmentText}${projectText}`; } } } @@ -474,9 +470,9 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter { event, ); default: - return `by updating strategy ${bold( - this.getStrategyTitle(event), - )} in ${bold(environment)}`; + return `by updating strategy *${this.getStrategyTitle( + event, + )}* in *${environment}*`; } }; @@ -526,9 +522,9 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter { const strategySpecificText = [usersText, constraintText, segmentsText] .filter((x) => x.length) .join(';'); - return `by updating strategy ${bold( - this.getStrategyTitle(event), - )} in ${bold(environment)}${strategySpecificText}`; + return `by updating strategy *${this.getStrategyTitle( + event, + )}* in *${environment}*${strategySpecificText}`; } private flexibleRolloutStrategyChangeText(event: IEvent) { @@ -574,9 +570,9 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter { ] .filter((txt) => txt.length) .join(';'); - return `by updating strategy ${bold( - this.getStrategyTitle(event), - )} in ${bold(environment)}${strategySpecificText}`; + return `by updating strategy *${this.getStrategyTitle( + event, + )}* in *${environment}*${strategySpecificText}`; } private defaultStrategyChangeText(event: IEvent) { @@ -592,9 +588,9 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter { const strategySpecificText = [constraintText, segmentsText] .filter((txt) => txt.length) .join(';'); - return `by updating strategy ${bold( - this.getStrategyTitle(event), - )} in ${bold(environment)}${strategySpecificText}`; + return `by updating strategy *${this.getStrategyTitle( + event, + )}* in *${environment}*${strategySpecificText}`; } private constraintChangeText( @@ -665,7 +661,7 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter { format(event: IEvent): IFormattedEventData { const { createdBy, type } = event; const { action, path } = EVENT_MAP[type] || { - action: `triggered ${bold(type)}`, + action: `triggered *${type}*`, }; const context = { diff --git a/src/lib/addons/slack-app.test.ts b/src/lib/addons/slack-app.test.ts index 056c3642145d..cac4d98dd88d 100644 --- a/src/lib/addons/slack-app.test.ts +++ b/src/lib/addons/slack-app.test.ts @@ -10,7 +10,6 @@ import { } from '../types'; import type { IntegrationEventsService } from '../services'; import type { Logger } from '../logger'; -import { bold } from './feature-event-formatter-md'; const slackApiCalls: ChatPostMessageArguments[] = []; @@ -272,7 +271,8 @@ describe('SlackAppAddon', () => { event: serializeDates(eventWith2Tags), details: { channels: ['general', 'another-channel-1', 'another-channel-2'], - message: `${bold('some@user.com')} enabled ${bold('')} for the ${bold('development')} environment in project ${bold('')}`, + message: + '*some@user.com* enabled ** for the *development* environment in project **', }, }); }); diff --git a/src/lib/addons/slack.test.ts b/src/lib/addons/slack.test.ts index 2e66ff755c53..eba87005c73e 100644 --- a/src/lib/addons/slack.test.ts +++ b/src/lib/addons/slack.test.ts @@ -17,7 +17,6 @@ import { SYSTEM_USER_ID, } from '../types'; import type { IntegrationEventsService } from '../services'; -import { bold } from './feature-event-formatter-md'; let fetchRetryCalls: any[] = []; const registerEventMock = jest.fn(); @@ -339,7 +338,8 @@ describe('Slack integration', () => { url: parameters.url, channels: ['general'], username: 'Unleash', - message: `${bold('some@user.com')} disabled ${bold('')} for the ${bold('development')} environment in project ${bold('')}`, + message: + '*some@user.com* disabled ** for the *development* environment in project **', }, }); }); diff --git a/src/lib/addons/teams.test.ts b/src/lib/addons/teams.test.ts index f15bf1a63da6..8c1b14c0bb46 100644 --- a/src/lib/addons/teams.test.ts +++ b/src/lib/addons/teams.test.ts @@ -18,7 +18,6 @@ import { SYSTEM_USER_ID, } from '../types'; import type { IntegrationEventsService } from '../services'; -import { bold } from './feature-event-formatter-md'; let fetchRetryCalls: any[]; const registerEventMock = jest.fn(); @@ -232,7 +231,7 @@ describe('Teams integration', () => { summary: 'Message', sections: [ { - activityTitle: `${bold(event.createdBy)} disabled ${bold(`[${event.featureName}](${ARGS.unleashUrl}/projects/${event.project}/features/${event.featureName})`)} for the ${bold(event.environment)} environment in project ${bold(`[${event.project}](${ARGS.unleashUrl}/projects/${event.project})`)}`, + activityTitle: `*${event.createdBy}* disabled *[${event.featureName}](${ARGS.unleashUrl}/projects/${event.project}/features/${event.featureName})* for the *${event.environment}* environment in project *[${event.project}](${ARGS.unleashUrl}/projects/${event.project})*`, activitySubtitle: `Unleash notification update`, facts: [ {