canSendNotification method

bool canSendNotification(
  1. String userid, {
  2. String notificationType = 'room',
})

The power level requirements for specific notification types.

Implementation

bool canSendNotification(String userid, {String notificationType = 'room'}) {
  final userLevel = getPowerLevelByUserId(userid);
  final notificationLevel = getState(EventTypes.RoomPowerLevels)
          ?.content
          .tryGetMap<String, Object?>('notifications')
          ?.tryGet<int>(notificationType) ??
      50;

  return userLevel >= notificationLevel;
}