Optimize viewId (#942)

This commit is contained in:
Alex Grebenyuk 2023-02-19 01:25:27 -05:00 committed by GitHub
parent 159bd74566
commit 5faf793fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,7 @@ public enum Visibility: String, Codable, CaseIterable, Hashable, Equatable, Send
}
public protocol AnyStatus {
var viewId: String { get }
var viewId: StatusViewId { get }
var id: String { get }
var content: HTMLString { get }
var account: Account { get }
@ -55,12 +55,14 @@ public protocol AnyStatus {
var language: String? { get }
}
public struct StatusViewId: Hashable {
let id: String
let editedAt: ServerDate?
}
public extension AnyStatus {
var viewId: String {
if let editedAt {
return "\(id)\(editedAt.asDate.description)"
}
return id
var viewId: StatusViewId {
StatusViewId(id: id, editedAt: editedAt)
}
}