mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-11 13:42:44 +02:00
Remove indentation level LocalCache.consume(ChannelCreateEvent)
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user