mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 22:46:22 +02:00
adds a prune for giftwrapped messages
This commit is contained in:
@@ -2178,6 +2178,8 @@ object LocalCache {
|
|||||||
val childrenToBeRemoved = mutableListOf<Note>()
|
val childrenToBeRemoved = mutableListOf<Note>()
|
||||||
|
|
||||||
toBeRemoved.forEach {
|
toBeRemoved.forEach {
|
||||||
|
// TODO: NEED TO TEST IF WRAPS COME BACK WHEN NEEDED BEFORE ACTIVATING
|
||||||
|
// childrenToBeRemoved.addAll(removeIfWrap(it))
|
||||||
removeFromCache(it)
|
removeFromCache(it)
|
||||||
|
|
||||||
childrenToBeRemoved.addAll(it.removeAllChildNotes())
|
childrenToBeRemoved.addAll(it.removeAllChildNotes())
|
||||||
@@ -2194,6 +2196,24 @@ object LocalCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeIfWrap(note: Note): List<Note> {
|
||||||
|
val noteEvent = note.event
|
||||||
|
|
||||||
|
val children =
|
||||||
|
if (noteEvent is WrappedEvent) {
|
||||||
|
noteEvent.host?.id?.let {
|
||||||
|
getNoteIfExists(it)?.let {
|
||||||
|
removeFromCache(it)
|
||||||
|
it.removeAllChildNotes()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
return children ?: emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
fun prunePastVersionsOfReplaceables() {
|
fun prunePastVersionsOfReplaceables() {
|
||||||
val toBeRemoved =
|
val toBeRemoved =
|
||||||
notes.filter { _, note ->
|
notes.filter { _, note ->
|
||||||
|
Reference in New Issue
Block a user