diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt index 52ee06409..00cb731f3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt @@ -852,7 +852,7 @@ object LocalCache : ILocalCache { val creator = event.host()?.let { checkGetOrCreateUser(it.pubKey) } ?: author - channel.updateChannelInfo(creator, event) + channel.updateChannelInfo(creator, event, note) refreshNewNoteObservers(note) @@ -1548,7 +1548,7 @@ object LocalCache : ILocalCache { if (oldChannel.creator == null || oldChannel.creator == author) { if (isVerified || justVerify(event)) { - oldChannel.updateChannelInfo(author, event) + oldChannel.updateChannelInfo(author, event, note) } } @@ -1567,6 +1567,8 @@ object LocalCache : ILocalCache { val oldChannel = checkGetOrCreatePublicChatChannel(channelId) ?: return false val author = getOrCreateUser(event.pubKey) + val note = getOrCreateNote(event.id) + val isVerified = if (event.createdAt > oldChannel.updatedMetadataAt) { if (wasVerified || justVerify(event)) { @@ -1579,7 +1581,6 @@ object LocalCache : ILocalCache { wasVerified } - val note = getOrCreateNote(event.id) if (note.event == null && (isVerified || justVerify(event))) { oldChannel.addNote(note, relay) note.loadEvent(event, author, emptyList()) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip28PublicChats/PublicChatChannel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip28PublicChats/PublicChatChannel.kt index e7ea766eb..cb77d53c8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip28PublicChats/PublicChatChannel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip28PublicChats/PublicChatChannel.kt @@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.model.nip28PublicChats import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.model.Channel +import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.note.toShortDisplay import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle @@ -39,6 +40,7 @@ class PublicChatChannel( ) : Channel() { var creator: User? = null var event: ChannelCreateEvent? = null + var eventNote: Note? = null var info = ChannelDataNorm(null, null, null, null) var infoTags = EmptyTagList @@ -61,13 +63,15 @@ class PublicChatChannel( fun updateChannelInfo( creator: User, event: ChannelCreateEvent, + eventNote: Note? = null, ) { this.creator = creator this.event = event - this.info = event.channelInfo() + this.infoTags = event.tags.toImmutableListOfLists() this.updatedMetadataAt = event.createdAt + this.eventNote = eventNote updateChannelInfo() } @@ -77,8 +81,8 @@ class PublicChatChannel( event: ChannelMetadataEvent, ) { this.creator = creator - this.info = event.channelInfo() + this.infoTags = event.tags.toImmutableListOfLists() this.updatedMetadataAt = event.createdAt diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip53LiveActivities/LiveActivitiesChannel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip53LiveActivities/LiveActivitiesChannel.kt index f846613e9..800ea64c5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip53LiveActivities/LiveActivitiesChannel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip53LiveActivities/LiveActivitiesChannel.kt @@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.model.nip53LiveActivities import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.model.Channel +import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.note.toShortDisplay import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag @@ -35,6 +36,7 @@ class LiveActivitiesChannel( ) : Channel() { var creator: User? = null var info: LiveActivitiesEvent? = null + var infoNote: Note? = null fun address() = address @@ -47,9 +49,11 @@ class LiveActivitiesChannel( fun updateChannelInfo( creator: User, channelInfo: LiveActivitiesEvent, + channelInfoNote: Note, ) { this.info = channelInfo this.creator = creator + this.infoNote = channelInfoNote super.updateChannelInfo() }