Skip to content

Commit 65a5965

Browse files
authored
Fix labels for new-dataset slack notifications (#9000)
Currently everything is logged to slack as "upload without conversion". That’s not quite right. ------ While not technically true just yet, it seems that this belongs here ![](https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExODhyb2NxbXdicnE4d2s0bWZ0bWlqMWYyZnNrdmU4MnByYnNxNm9sNyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/tPKoWQJk3cEbC/giphy.gif) Related: #3000 ------ - [x] Removed dev-only changes like prints and application.conf edits - [x] Considered [common edge cases](../blob/master/.github/common_edge_cases.md)
1 parent 4ea0239 commit 65a5965

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

app/controllers/DatasetController.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class DatasetController @Inject()(userService: UserService,
239239
user,
240240
needsConversion = false,
241241
datasetSizeBytes = 0,
242-
viaAddRoute = false)
242+
addVariantLabel = "via explore+add")
243243
} yield Ok(Json.obj("newDatasetId" -> dataset._id))
244244
}
245245

@@ -663,7 +663,7 @@ class DatasetController @Inject()(userService: UserService,
663663
request.identity,
664664
needsConversion = false,
665665
datasetSizeBytes = 0,
666-
viaAddRoute = false)
666+
addVariantLabel = "via uploadToPaths/publish")
667667
} yield Ok
668668
}
669669

app/controllers/WKRemoteDataStoreController.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class WKRemoteDataStoreController @Inject()(
136136
user,
137137
request.body.needsConversion,
138138
request.body.datasetSizeBytes,
139-
viaAddRoute = false)
139+
addVariantLabel = "upload without conversion")
140140
dataSourceWithLinkedLayersOpt <- Fox.runOptional(request.body.dataSourceOpt) {
141141
implicit val ctx: DBAccessContext = AuthorizedAccessContext(user)
142142
layerToLinkService.addLayersToLinkToDataSource(_, request.body.layersToLink)

app/models/dataset/DatasetService.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,22 +549,21 @@ class DatasetService @Inject()(organizationDAO: OrganizationDAO,
549549
user: User,
550550
needsConversion: Boolean,
551551
datasetSizeBytes: Long,
552-
viaAddRoute: Boolean): Fox[Unit] =
552+
addVariantLabel: String): Fox[Unit] =
553553
for {
554-
_ <- Fox.runIf(!needsConversion)(logDatasetUploadToSlack(user, dataset._id, viaAddRoute))
554+
_ <- Fox.runIf(!needsConversion)(logDatasetUploadToSlack(user, dataset._id, addVariantLabel))
555555
dataStore <- dataStoreDAO.findOneByName(dataset._dataStore)(GlobalAccessContext)
556556
_ = analyticsService.track(UploadDatasetEvent(user, dataset, dataStore, datasetSizeBytes))
557557
_ = if (!needsConversion) mailchimpClient.tagUser(user, MailchimpTag.HasUploadedOwnDataset)
558558
} yield ()
559559

560-
private def logDatasetUploadToSlack(user: User, datasetId: ObjectId, viaAddRoute: Boolean): Fox[Unit] =
560+
private def logDatasetUploadToSlack(user: User, datasetId: ObjectId, addVariantLabel: String): Fox[Unit] =
561561
for {
562562
organization <- organizationDAO.findOne(user._organization)(GlobalAccessContext)
563563
multiUser <- multiUserDAO.findOne(user._multiUser)(GlobalAccessContext)
564564
resultLink = s"${conf.Http.uri}/datasets/$datasetId"
565-
addLabel = if (viaAddRoute) "(via explore+add)" else "(upload without conversion)"
566565
superUserLabel = if (multiUser.isSuperUser) " (for superuser)" else ""
567-
_ = slackNotificationService.info(s"Dataset added $addLabel$superUserLabel",
566+
_ = slackNotificationService.info(s"Dataset added ($addVariantLabel)$superUserLabel",
568567
s"For organization: ${organization.name}. <$resultLink|Result>")
569568
} yield ()
570569

0 commit comments

Comments
 (0)