the-algorithm/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/transforms/modify_social_proof/RemoveAccountProofTransform.scala
twitter-team ef4c5eb65e Twitter Recommendation Algorithm
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.
2023-03-31 17:36:31 -05:00

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)
})
}