don't publish timeline entries when liking own study
parent
7ac63a5ccd
commit
0c8dc112dc
|
@ -409,9 +409,10 @@ final class StudyApi(
|
|||
def like(studyId: Study.Id, userId: User.ID, v: Boolean, socket: ActorRef, uid: Uid): Funit =
|
||||
studyRepo.like(studyId, userId, v) map { likes =>
|
||||
sendTo(studyId, Socket.SetLiking(Study.Liking(likes, v), uid))
|
||||
if (v) studyRepo.nameById(studyId) foreach {
|
||||
_ ?? { name =>
|
||||
timeline ! (Propagate(StudyLike(userId, studyId.value, name)) toFollowersOf userId)
|
||||
if (v) studyRepo byId studyId foreach {
|
||||
_ foreach { study =>
|
||||
if (userId != study.ownerId)
|
||||
timeline ! (Propagate(StudyLike(userId, study.id.value, study.name.value)) toFollowersOf userId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ final class StudyRepo(private[study] val coll: Coll) {
|
|||
implicit cp: CursorProducer[Study]) =
|
||||
coll.find(selector).cursor[Study](readPreference)
|
||||
|
||||
def nameById(id: Study.Id) = coll.primitiveOne[String]($id(id), "name")
|
||||
|
||||
def exists(id: Study.Id) = coll.exists($id(id))
|
||||
|
||||
private[study] def selectOwnerId(ownerId: User.ID) = $doc("ownerId" -> ownerId)
|
||||
|
|
Loading…
Reference in New Issue