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()
null
}
}.filterNotNull(),
}.filterNotNull().toSet(),
event.createdAt
)

View File

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