automatically tag broadcasts with the "Broadcast" study topic
parent
e1854ce94e
commit
fef47d2e4c
|
@ -69,7 +69,8 @@ final class RelayApi(
|
|||
from = Study.From.Relay(none).some
|
||||
),
|
||||
user
|
||||
) inject relay
|
||||
) >>
|
||||
studyApi.addTopics(relay.studyId, List("Broadcast")) inject relay
|
||||
}
|
||||
|
||||
def requestPlay(id: Relay.Id, v: Boolean): Funit = WithRelay(id) { relay =>
|
||||
|
|
|
@ -71,6 +71,10 @@ case class Study(
|
|||
def light = LightStudy(isPublic, members.contributorIds)
|
||||
|
||||
def topicsOrEmpty = topics | StudyTopics.empty
|
||||
|
||||
def addTopics(ts: StudyTopics) = copy(
|
||||
topics = topics.fold(ts)(_ ++ ts).some
|
||||
)
|
||||
}
|
||||
|
||||
object Study {
|
||||
|
|
|
@ -740,6 +740,10 @@ final class StudyApi(
|
|||
}
|
||||
}
|
||||
|
||||
def addTopics(studyId: Study.Id, topics: List[String]) = sequenceStudy(studyId) { study =>
|
||||
studyRepo.updateTopics(study addTopics StudyTopics.fromStrs(topics))
|
||||
}
|
||||
|
||||
def editStudy(studyId: Study.Id, data: Study.Data)(who: Who) = sequenceStudy(studyId) { study =>
|
||||
canActAsOwner(study, who.u) flatMap { asOwner =>
|
||||
data.settings.ifTrue(asOwner) ?? { settings =>
|
||||
|
|
|
@ -29,6 +29,10 @@ case class StudyTopics(value: List[StudyTopic]) extends AnyVal {
|
|||
def diff(other: StudyTopics) = StudyTopics {
|
||||
value.toSet.diff(other.value.toSet).toList
|
||||
}
|
||||
|
||||
def ++(other: StudyTopics) = StudyTopics {
|
||||
value.toSet.++(other.value.toSet).toList
|
||||
}
|
||||
}
|
||||
|
||||
object StudyTopics {
|
||||
|
|
Loading…
Reference in New Issue