Procházet zdrojové kódy

Merge pull request #19818 from overleaf/ab-fix-split-test-archived-notification-comment

[web] Skip sending last versions comment with archived test notification

GitOrigin-RevId: 997111220161eaf7588cac8809024ac4a09bc037
Alexandre Bourdin před 2 roky
rodič
revize
972fbb7c67

+ 5 - 1
services/web/app/src/Features/SplitTests/SlackNotificationManager.js

@@ -30,6 +30,10 @@ async function sendNotification(splitTest, action, user) {
   ].join('\n')
   ].join('\n')
 
 
   const date = splitTest.archived ? splitTest.archivedAt : lastVersion.createdAt
   const date = splitTest.archived ? splitTest.archivedAt : lastVersion.createdAt
+  const comment =
+    action !== 'archived' && lastVersion.comment
+      ? `with comment: ${lastVersion.comment}`
+      : ''
 
 
   const payload = {
   const payload = {
     name: splitTest.name,
     name: splitTest.name,
@@ -41,7 +45,7 @@ async function sendNotification(splitTest, action, user) {
     active: lastVersion.active.toString(),
     active: lastVersion.active.toString(),
     author: user.email,
     author: user.email,
     date: moment(date).utc().format('Do MMM YYYY, h:mm a') + ' UTC',
     date: moment(date).utc().format('Do MMM YYYY, h:mm a') + ' UTC',
-    comment: lastVersion.comment ? `with comment: ${lastVersion.comment}` : '',
+    comment,
     versionNumber: `${lastVersion.versionNumber}`,
     versionNumber: `${lastVersion.versionNumber}`,
     url: `${Settings.siteUrl}/admin/split-test/edit/${splitTest.name}`,
     url: `${Settings.siteUrl}/admin/split-test/edit/${splitTest.name}`,
   }
   }