mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
26 lines
708 B
Scala
26 lines
708 B
Scala
|
package com.twitter.frigate.pushservice.model.ibis
|
||
|
|
||
|
import com.twitter.frigate.pushservice.model.PushTypes.PushCandidate
|
||
|
import com.twitter.ibis2.lib.util.JsonMarshal
|
||
|
import com.twitter.util.Future
|
||
|
|
||
|
trait CustomConfigurationMapForIbis {
|
||
|
self: PushCandidate =>
|
||
|
|
||
|
lazy val customConfigMapsJsonFut: Future[String] = {
|
||
|
customFieldsMapFut.map { customFields =>
|
||
|
JsonMarshal.toJson(customFields)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
lazy val customConfigMapsFut: Future[Map[String, String]] = {
|
||
|
if (self.target.isLoggedOutUser) {
|
||
|
Future.value(Map.empty[String, String])
|
||
|
} else {
|
||
|
customConfigMapsJsonFut.map { customConfigMapsJson =>
|
||
|
Map("custom_config" -> customConfigMapsJson)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|