Remove indentation level LocalCache.consume(ChannelCreateEvent)

This commit is contained in:
Chemaclass
2023-03-11 20:43:46 +00:00
parent d166f22c58
commit 30f4ff9d6f

View File

@@ -589,21 +589,19 @@ object LocalCache {
fun consume(event: ChannelCreateEvent) { fun consume(event: ChannelCreateEvent) {
// Log.d("MT", "New Event ${event.content} ${event.id.toHex()}") // Log.d("MT", "New Event ${event.content} ${event.id.toHex()}")
// new event
val oldChannel = getOrCreateChannel(event.id) val oldChannel = getOrCreateChannel(event.id)
val author = getOrCreateUser(event.pubKey) val author = getOrCreateUser(event.pubKey)
if (event.createdAt > oldChannel.updatedMetadataAt) { if (event.createdAt <= oldChannel.updatedMetadataAt) {
if (oldChannel.creator == null || oldChannel.creator == author) { return // older data, does nothing
oldChannel.updateChannelInfo(author, event.channelInfo(), event.createdAt) }
if (oldChannel.creator == null || oldChannel.creator == author) {
oldChannel.updateChannelInfo(author, event.channelInfo(), event.createdAt)
val note = getOrCreateNote(event.id) val note = getOrCreateNote(event.id)
oldChannel.addNote(note) oldChannel.addNote(note)
note.loadEvent(event, author, emptyList(), emptyList()) note.loadEvent(event, author, emptyList(), emptyList())
refreshObservers() refreshObservers()
}
} else {
// older data, does nothing
} }
} }
@@ -799,7 +797,7 @@ object LocalCache {
} }
fun pruneOldAndHiddenMessages(account: Account) { fun pruneOldAndHiddenMessages(account: Account) {
channels.forEach { channels.forEach { it ->
val toBeRemoved = it.value.pruneOldAndHiddenMessages(account) val toBeRemoved = it.value.pruneOldAndHiddenMessages(account)
toBeRemoved.forEach { toBeRemoved.forEach {
@@ -815,7 +813,7 @@ object LocalCache {
} }
// Counts the replies // Counts the replies
it.replyTo?.forEach { replyingNote -> it.replyTo?.forEach { _ ->
it.removeReply(it) it.removeReply(it)
} }
} }