mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 12:01:45 +02:00
Fixes lack of feed updates for those that didn't follow any communities
This commit is contained in:
@@ -70,7 +70,12 @@ class OutboxRelaySetState(
|
||||
usersToLoad
|
||||
.transformLatest { followList ->
|
||||
val flows: List<StateFlow<NoteState>> = allRelayListFlows(followList)
|
||||
val relayListFlows = combineAllFlows(flows)
|
||||
val relayListFlows =
|
||||
if (flows.isEmpty()) {
|
||||
MutableStateFlow(emptySet())
|
||||
} else {
|
||||
combineAllFlows(flows)
|
||||
}
|
||||
emitAll(relayListFlows)
|
||||
}.onStart {
|
||||
emit(
|
||||
|
@@ -27,6 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent
|
||||
import com.vitorpamplona.quartz.utils.mapOfSet
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
|
||||
class CommunityRelayLoader {
|
||||
@@ -81,8 +82,12 @@ class CommunityRelayLoader {
|
||||
?.stateFlow
|
||||
}
|
||||
|
||||
return combine(noteMetadataFlows) { communityNotes ->
|
||||
transformation(communitiesPerRelay(communityNotes, cache))
|
||||
return if (noteMetadataFlows.isEmpty()) {
|
||||
MutableStateFlow(transformation(emptyMap()))
|
||||
} else {
|
||||
combine(noteMetadataFlows) { communityNotes ->
|
||||
transformation(communitiesPerRelay(communityNotes, cache))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent
|
||||
import com.vitorpamplona.quartz.utils.mapOfSet
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
|
||||
class OutboxRelayLoader {
|
||||
@@ -86,8 +87,12 @@ class OutboxRelayLoader {
|
||||
note.flow().metadata.stateFlow
|
||||
}
|
||||
|
||||
return combine(noteMetadataFlows) { outboxRelays ->
|
||||
transformation(authorsPerRelay(outboxRelays, cache))
|
||||
return if (noteMetadataFlows.isEmpty()) {
|
||||
MutableStateFlow(transformation(emptyMap()))
|
||||
} else {
|
||||
combine(noteMetadataFlows) { outboxRelays ->
|
||||
transformation(authorsPerRelay(outboxRelays, cache))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -86,6 +86,7 @@ class AllFollowsByOutboxTopNavFilter(
|
||||
} else {
|
||||
MutableStateFlow(emptyMap())
|
||||
}
|
||||
|
||||
val communitiesPerRelay =
|
||||
if (communities != null) {
|
||||
CommunityRelayLoader.toCommunitiesPerRelayFlow(communities, cache) { it }
|
||||
@@ -116,6 +117,7 @@ class AllFollowsByOutboxTopNavFilter(
|
||||
} else {
|
||||
emptyMap()
|
||||
}
|
||||
|
||||
val communitiesPerRelay =
|
||||
if (communities != null) {
|
||||
CommunityRelayLoader.communitiesPerRelaySnapshot(communities, cache) { it }
|
||||
|
@@ -222,7 +222,7 @@ class AccountViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
if (flows != null) {
|
||||
if (!flows.isNullOrEmpty()) {
|
||||
combine(flows) {
|
||||
it.any { it }
|
||||
}
|
||||
|
Reference in New Issue
Block a user