simplify check for sharing location to user

This commit is contained in:
Chumva 2018-12-05 18:03:46 +02:00
parent 9b6aa48639
commit 3acd73dcaf

View file

@ -113,14 +113,7 @@ class TelegramSettings(private val app: TelegramApplication) {
fun isSharingLocationToChat(chatId: Long) = shareChatsInfo.containsKey(chatId) fun isSharingLocationToChat(chatId: Long) = shareChatsInfo.containsKey(chatId)
fun isSharingLocationToUser(userId: Int): Boolean { fun isSharingLocationToUser(userId: Int) = shareChatsInfo.values.any { it.userId == userId }
shareChatsInfo.forEach { (_, shareInfo: ShareChatInfo) ->
if (shareInfo.userId == userId) {
return true
}
}
return false
}
fun hasAnyChatToShowOnMap() = !hiddenOnMapChats.containsAll(getLiveNowChats()) fun hasAnyChatToShowOnMap() = !hiddenOnMapChats.containsAll(getLiveNowChats())