status: fix status events not expiring locally

Changelog-Fixed: Fix status events not expiring locally
This commit is contained in:
William Casarin
2023-08-23 16:11:48 -07:00
parent 042b7da315
commit 23a8d6fb6b
4 changed files with 38 additions and 4 deletions

View File

@@ -359,6 +359,7 @@ struct ContentView: View {
}
.onReceive(timer) { n in
self.damus_state?.postbox.try_flushing_events()
self.damus_state!.profiles.profile_data(self.damus_state!.pubkey).status.try_expire()
}
.onReceive(handle_notify(.report)) { target in
self.active_sheet = .report(target)
@@ -670,7 +671,8 @@ struct ContentView: View {
let pdata = damus_state.profiles.profile_data(damus_state.pubkey)
let music = UserStatus(type: .music, expires_at: Date.now.addingTimeInterval(song.playbackDuration), content: "\(song.title ?? "Unknown") - \(song.artist ?? "Unknown")")
let music = UserStatus(type: .music, expires_at: Date.now.addingTimeInterval(song.playbackDuration), content: "\(song.title ?? "Unknown") - \(song.artist ?? "Unknown")", created_at: UInt32(Date.now.timeIntervalSince1970))
pdata.status.music = music
guard let ev = music.to_note(keypair: kp) else { return }