This commit is contained in:
Nils Büchner 2024-09-15 00:11:33 +02:00
parent b7174bd16c
commit a28942aadd

View file

@ -182,26 +182,28 @@ class InviteChecker:
inviter_domain = UserID.from_string(inviter).domain
logger.debug(f"Blocklist: {blocklist}, Allowlist: {allowlist}, Blocklist Room IDs: {blocklist_room_ids}")
if self.use_allowlist:
logger.info(f"Allowlist enabled. Checking domain: {inviter_domain}")
if inviter_domain in allowlist:
logger.info(f"Invite allowed: {inviter_domain} is on the allowlist")
returnValue("NOT_SPAM")
if room_id in blocklist_room_ids:
logger.info(f"Invite blocked: room {room_id} is blocklisted")
returnValue(errors.Codes.FORBIDDEN)
if self.use_allowlist:
logger.info(f"Allowlist enabled. Checking domain: {inviter_domain}")
if inviter_domain in allowlist:
logger.info(f"Invite allowed: {inviter_domain} is in the allowlist")
returnValue("NOT_SPAM")
if self.use_blocklist:
logger.info(f"Blocklist enabled. Checking domain: {inviter_domain}")
logger.info(f"Blocklist enabled. Checking {inviter}")
if inviter_domain in blocklist:
logger.info(f"Invite blocked: {inviter_domain} is in the blocklist")
logger.info(f"Invite blocked: {inviter_domain} is on the blocklist")
returnValue(errors.Codes.FORBIDDEN)
if self.use_allowlist and inviter_domain not in allowlist:
logger.info(f"Invite blocked: {inviter_domain} is not in the allowlist")
if inviter in blocklist:
logger.info(f"Invite blocked: {inviter} is on the blocklist")
returnValue(errors.Codes.FORBIDDEN)
elif self.use_allowlist and inviter_domain not in allowlist:
logger.info(f"Invite blocked: {inviter_domain} is not on the allowlist")
returnValue(errors.Codes.FORBIDDEN)
logger.info(f"Invite allowed by default: {inviter_domain}")
logger.info(f"Invite allowed by default: {inviter}")
returnValue("NOT_SPAM")