Making sure an empty relay list uses the default list from Amethyst
This commit is contained in:
@@ -2761,19 +2761,22 @@ class Account(
|
|||||||
// Takes a User's relay list and adds the types of feeds they are active for.
|
// Takes a User's relay list and adds the types of feeds they are active for.
|
||||||
fun activeRelays(): Array<RelaySetupInfo>? {
|
fun activeRelays(): Array<RelaySetupInfo>? {
|
||||||
val usersRelayList =
|
val usersRelayList =
|
||||||
userProfile().latestContactList?.relays()?.map {
|
userProfile()
|
||||||
val url = RelayUrlFormatter.normalize(it.key)
|
.latestContactList
|
||||||
|
?.relays()
|
||||||
|
?.map {
|
||||||
|
val url = RelayUrlFormatter.normalize(it.key)
|
||||||
|
|
||||||
val localFeedTypes =
|
val localFeedTypes =
|
||||||
localRelays.firstOrNull { localRelay -> RelayUrlFormatter.normalize(localRelay.url) == url }?.feedTypes?.minus(setOf(FeedType.SEARCH, FeedType.WALLET_CONNECT))
|
localRelays.firstOrNull { localRelay -> RelayUrlFormatter.normalize(localRelay.url) == url }?.feedTypes?.minus(setOf(FeedType.SEARCH, FeedType.WALLET_CONNECT))
|
||||||
?: Constants.defaultRelays
|
?: Constants.defaultRelays
|
||||||
.filter { defaultRelay -> defaultRelay.url == url }
|
.filter { defaultRelay -> defaultRelay.url == url }
|
||||||
.firstOrNull()
|
.firstOrNull()
|
||||||
?.feedTypes
|
?.feedTypes
|
||||||
?: Constants.activeTypesGlobalChats
|
?: Constants.activeTypesGlobalChats
|
||||||
|
|
||||||
RelaySetupInfo(url, it.value.read, it.value.write, localFeedTypes)
|
RelaySetupInfo(url, it.value.read, it.value.write, localFeedTypes)
|
||||||
} ?: return null
|
}?.ifEmpty { null } ?: return null
|
||||||
|
|
||||||
return usersRelayList.toTypedArray()
|
return usersRelayList.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user