mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-13 14:48:54 +02:00
ef4c5eb65e
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
28 lines
1.0 KiB
Scala
28 lines
1.0 KiB
Scala
package com.twitter.follow_recommendations.common.transforms.modify_social_proof
|
|
|
|
import com.twitter.finagle.stats.StatsReceiver
|
|
import com.twitter.follow_recommendations.common.base.GatedTransform
|
|
import com.twitter.follow_recommendations.common.models.CandidateUser
|
|
import com.twitter.product_mixer.core.model.marshalling.request.HasClientContext
|
|
import com.twitter.stitch.Stitch
|
|
import com.twitter.timelines.configapi.HasParams
|
|
import javax.inject.Inject
|
|
import javax.inject.Singleton
|
|
|
|
@Singleton
|
|
class RemoveAccountProofTransform @Inject() (statsReceiver: StatsReceiver)
|
|
extends GatedTransform[HasClientContext with HasParams, CandidateUser] {
|
|
|
|
private val stats = statsReceiver.scope(this.getClass.getSimpleName)
|
|
private val removedProofsCounter = stats.counter("num_removed_proofs")
|
|
|
|
override def transform(
|
|
target: HasClientContext with HasParams,
|
|
items: Seq[CandidateUser]
|
|
): Stitch[Seq[CandidateUser]] =
|
|
Stitch.value(items.map { candidate =>
|
|
removedProofsCounter.incr()
|
|
candidate.copy(reason = None)
|
|
})
|
|
}
|