Skip to content

Commit

Permalink
Remove redundant room check, fixes element-hq/element-ios#3354
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailgulek committed Jun 23, 2020
1 parent a9cd484 commit e965f84
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@ - (BOOL)isCondition:(MXPushRuleCondition*)condition satisfiedBy:(MXEvent*)event
MXJSONModelSetString(notifLevelKey, condition.parameters[@"key"]);
if (notifLevelKey)
{
MXRoom *room = [mxSession roomWithRoomId:event.roomId];
if (room)
{
MXRoomPowerLevels *roomPowerLevels = roomState.powerLevels;
NSInteger notifLevel = [roomPowerLevels minimumPowerLevelForNotifications:notifLevelKey defaultPower:50];
NSInteger senderPowerLevel = [roomPowerLevels powerLevelOfUserWithUserID:event.sender];
MXRoomPowerLevels *roomPowerLevels = roomState.powerLevels;
NSInteger notifLevel = [roomPowerLevels minimumPowerLevelForNotifications:notifLevelKey defaultPower:50];
NSInteger senderPowerLevel = [roomPowerLevels powerLevelOfUserWithUserID:event.sender];

isSatisfied = (senderPowerLevel >= notifLevel);
}
isSatisfied = (senderPowerLevel >= notifLevel);
}

return isSatisfied;
Expand Down

0 comments on commit e965f84

Please sign in to comment.