feat: foss merge changes from review

This commit is contained in:
JanNiklas Grabowski
2024-08-20 12:58:18 +02:00
parent eb005301ee
commit a3a9fc2c66
5 changed files with 23 additions and 13 deletions
@@ -339,15 +339,16 @@ static NSString *const kNSFWKeyword = @"nsfw";
for (MXPublicRoom *publicRoom in publicRooms)
{
BOOL shouldAllow = YES;
if (publicRoom.name != nil) {
shouldAllow &= [self.forbiddenTermsRegex numberOfMatchesInString:publicRoom.name options:0 range:NSMakeRange(0, publicRoom.name.length)] == 0;
// BWI: #6076 enable nsfw filtering
if (BWIBuildSettings.shared.enableNSFWFilter) {
if (publicRoom.name != nil) {
shouldAllow &= [self.forbiddenTermsRegex numberOfMatchesInString:publicRoom.name options:0 range:NSMakeRange(0, publicRoom.name.length)] == 0;
}
if (publicRoom.topic != nil) {
shouldAllow &= [self.forbiddenTermsRegex numberOfMatchesInString:publicRoom.topic options:0 range:NSMakeRange(0, publicRoom.topic.length)] == 0;
}
}
if (publicRoom.topic != nil) {
shouldAllow &= [self.forbiddenTermsRegex numberOfMatchesInString:publicRoom.topic options:0 range:NSMakeRange(0, publicRoom.topic.length)] == 0;
}
if (shouldAllow) {
[filteredRooms addObject:publicRoom];
}