You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log.info(`User ${user.id} initiated LLMO enrollment removal for site ${siteId} (${brandURL})`);
815
+
816
+
// Update the original message to show user's action
817
+
awaitclient.chat.update({
818
+
channel: originalChannel,
819
+
ts: body.message.ts,
820
+
text: `:warning: ${user.name} is removing LLMO enrollment for ${brandURL}...`,
821
+
blocks: [
822
+
{
823
+
type: 'section',
824
+
text: {
825
+
type: 'mrkdwn',
826
+
text: `:warning: ${user.name} is removing LLMO enrollment for ${brandURL}...`,
827
+
},
828
+
},
829
+
],
830
+
});
831
+
832
+
// Show confirmation modal
833
+
awaitclient.views.open({
834
+
trigger_id: body.trigger_id,
835
+
view: {
836
+
type: 'modal',
837
+
callback_id: 'confirm_remove_llmo_enrollment',
838
+
private_metadata: JSON.stringify({
839
+
brandURL,
840
+
siteId,
841
+
existingBrand,
842
+
originalChannel,
843
+
originalThreadTs,
844
+
originalMessageTs: body.message.ts,
845
+
}),
846
+
title: {
847
+
type: 'plain_text',
848
+
text: 'Confirm Removal',
849
+
},
850
+
submit: {
851
+
type: 'plain_text',
852
+
text: 'Remove Enrollment',
853
+
},
854
+
close: {
855
+
type: 'plain_text',
856
+
text: 'Cancel',
857
+
},
858
+
blocks: [
859
+
{
860
+
type: 'section',
861
+
text: {
862
+
type: 'mrkdwn',
863
+
text: `:warning: *Are you sure you want to remove LLMO enrollment?*\n\n*Site:* ${brandURL}\n*Brand:* ${existingBrand}\n\nThis action will:\n• Revoke the site's LLMO enrollment\n• Remove access to LLMO features for this site\n\n*This action cannot be undone.*`,
text: `:gear: Removing LLMO enrollment for ${brandURL}...`,
909
+
thread_ts: responseThreadTs,
910
+
});
911
+
912
+
try{
913
+
// Find the site
914
+
const{ Site }=dataAccess;
915
+
constsite=awaitSite.findById(siteId);
916
+
917
+
if(!site){
918
+
thrownewError(`Site not found: ${siteId}`);
919
+
}
920
+
921
+
// Use the reusable removeEnrollment function from the LLMO controller
922
+
awaitremoveEnrollment(site,lambdaContext);
923
+
924
+
log.info(`Successfully revoked LLMO enrollment for site ${siteId} (${brandURL})`);
925
+
926
+
// Update the original message to show completion
927
+
if(originalMessageTs){
928
+
awaitclient.chat.update({
929
+
channel: responseChannel,
930
+
ts: originalMessageTs,
931
+
text: `:white_check_mark: LLMO enrollment removed for ${brandURL}`,
932
+
blocks: [
933
+
{
934
+
type: 'section',
935
+
text: {
936
+
type: 'mrkdwn',
937
+
text: `:white_check_mark: *LLMO Enrollment Removed*\n\nThe LLMO enrollment for *${brandURL}* (brand: *${existingBrand}*) has been successfully removed by ${user.name}.`,
0 commit comments