Start of the work to have following since <date>

This commit is contained in:
Vitor Pamplona
2023-01-22 18:31:23 -03:00
parent 38c17f9024
commit 53eeba210a
2 changed files with 4 additions and 4 deletions

View File

@ -144,7 +144,7 @@ object LocalCache {
e.printStackTrace() e.printStackTrace()
null null
} }
}.filterNotNull(), }.filterNotNull().toSet(),
event.createdAt event.createdAt
) )

View File

@ -49,7 +49,7 @@ class User(val pubkey: ByteArray) {
return info.picture ?: "https://robohash.org/${pubkeyHex}.png" return info.picture ?: "https://robohash.org/${pubkeyHex}.png"
} }
fun follow(user: User) { fun follow(user: User, followedAt: Long) {
follows.add(user) follows.add(user)
user.followers.add(this) user.followers.add(this)
@ -78,7 +78,7 @@ class User(val pubkey: ByteArray) {
live.refresh() live.refresh()
} }
fun updateFollows(newFollows: List<User>, updateAt: Long) { fun updateFollows(newFollows: Set<User>, updateAt: Long) {
val toBeAdded = synchronized(follows) { val toBeAdded = synchronized(follows) {
newFollows - follows newFollows - follows
} }
@ -86,7 +86,7 @@ class User(val pubkey: ByteArray) {
follows - newFollows follows - newFollows
} }
toBeAdded.forEach { toBeAdded.forEach {
follow(it) follow(it, updateAt)
} }
toBeRemoved.forEach { toBeRemoved.forEach {
unfollow(it) unfollow(it)