chibenwa commented on code in PR #2491:
URL: https://github.com/apache/james-project/pull/2491#discussion_r1835551276
##########
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/MailboxSet.scala:
##########
@@ -265,13 +267,28 @@ object NameUpdate {
}
}
+object IsSubscribedUpdate {
+ def parse(newValue: JsValue): Either[PatchUpdateValidationException, Update]
= newValue match {
+ case JsBoolean(value) =>
scala.Right(IsSubscribedUpdate(Some(IsSubscribed(value))))
+ case JsNull => scala.Right(IsSubscribedUpdate(None))
+ case _ => Left(InvalidUpdateException("isSubscribed", "Expecting a JSON
boolean as an argument"))
+ }
+}
+
+object SharedWithAnyoneValidator {
+ def isValidPatch(entryKey: EntryKey, rights: Seq[Right]): Boolean = {
+ !((entryKey == ANYONE_KEY || entryKey == ANYONE_NEGATIVE_KEY) &&
rights.exists(_ != Right.Post))}
+
+ def areValidPatches(rightsMap: Map[EntryKey, Seq[Right]]): Boolean = {
+ rightsMap.forall { case (entryKey, rightsSeq) => isValidPatch(entryKey,
rightsSeq)}}
+}
Review Comment:
```suggestion
def areValidPatches(rightsMap: Map[EntryKey, Seq[Right]]): Boolean =
rightsMap.forall { case (entryKey, rightsSeq) => isValidPatch(entryKey,
rightsSeq)}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]