#42 Add tests for FollowVoter

This commit is contained in:
2020-03-17 11:47:25 +01:00
parent 559adb7e2a
commit d8251f1dd2
2 changed files with 146 additions and 9 deletions

View File

@@ -13,7 +13,7 @@ class FollowVoter : Voter {
override fun supports(action: ActionI, call: ApplicationCall, subject: Any?): Boolean {
return (action is Action)
.and(subject is List<*> || subject is FollowEntity<*>?)
.and(subject is FollowEntity<*>?)
}
override fun vote(action: ActionI, call: ApplicationCall, subject: Any?): Vote {
@@ -32,14 +32,6 @@ class FollowVoter : Voter {
if (subject is FollowEntity<*>) {
return voteView(user, subject)
}
if (subject is List<*>) {
subject.forEach {
if (it !is FollowEntity<*> || voteView(user, it) == Vote.DENIED) {
return Vote.DENIED
}
}
return Vote.GRANTED
}
return Vote.DENIED
}