plugin XEP-0033: Fix validation error when only metadata address are used:
XEP-0033 may be used as a simple metadata marker when sending messages (e.g. to indicate a `replyto`). The validation was failing on that due to missing `to`, `cc` and `bcc`.
This commit is contained in:
parent
2c5713b486
commit
2b0f4bd192
1 changed files with 3 additions and 1 deletions
|
|
@ -126,7 +126,9 @@ class AddressesData(BaseModel):
|
|||
|
||||
@model_validator(mode="after")
|
||||
def check_minimal_data(self) -> Self:
|
||||
assert self.to or self.cc or self.bcc, "At least one recipent must be set"
|
||||
has_recipient = self.to or self.cc or self.bcc
|
||||
has_metadata = self.replyto or self.replyroom or self.noreply or self.ofrom
|
||||
assert has_recipient or has_metadata, "At least one address field must be set"
|
||||
if self.noreply and (self.replyto is not None or self.replyroom is not None):
|
||||
log.warning(
|
||||
'"noreply" can\'t be used with "replyto" or "replyroom". Ignoring reply '
|
||||
|
|
|
|||
Loading…
Reference in a new issue