code: private boolean isNotificationsEnabled(Peer peer, boolean hasMention) {
  
          // If notifications doesn't enabled at all
          if (!context().getSettingsModule().isNotificationsEnabled()) {
              return false;
          }
  
          // Notifications for groups
          if (peer.getPeerType() == PeerType.GROUP) {
  
              // Disable notifications for hidden groups
              if (getGroup(peer.getPeerId()).isHidden()) {
                  return false;
              }
  
              if (context().getSettingsModule().isGroupNotificationsEnabled()) {
  
                  // If there are mention in group always allow notification
                  if (hasMention) {
                      return true;
                  }
  
                  if (context().getSettingsModule().isNotificationsEnabled(peer)) {
  
                      // If forced only mentions
                      if (context().getSettingsModule().isGroupNotificationsOnlyMentionsEnabled()) {
                          return false; // hasMention always false at this line
                      } else {
                          return true;
                      }
                  } else {
  
                      // Notifications are not enabled in group
                      return false;
                  }
              } else {
  
                  // All group notifications are disabled
                  return false;
              }
          } else if (peer.getPeerType() == PeerType.PRIVATE) {
  
              // For private conversations only check if peer notifications enabled
              return context().getSettingsModule().isNotificationsEnabled(peer);
          } else {
  
              // Never happens
              throw new RuntimeException("Unknown peer type");
          }
      }
docs: Testing if notifications enabled for message
  
  @param peer       peer of message
  @param hasMention does peer have mention
  @return is notification enabled for peer