Move poll query code to MastodonStatus
This commit is contained in:
parent
54b020ff61
commit
c354eeb4d8
@ -58,3 +58,15 @@ public extension Mastodon.Entity.Status {
|
||||
return MastodonVisibility(rawValue: visibility)
|
||||
}
|
||||
}
|
||||
|
||||
public extension MastodonStatus {
|
||||
func getPoll(in context: NSManagedObjectContext, domain: String) async -> Poll? {
|
||||
guard
|
||||
let pollId = entity.poll?.id
|
||||
else { return nil }
|
||||
return try? await context.perform {
|
||||
let predicate = Poll.predicate(domain: domain, id: pollId)
|
||||
return Poll.findOrFetch(in: context, matching: predicate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -535,15 +535,3 @@ extension StatusView {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension MastodonStatus {
|
||||
func getPoll(in context: NSManagedObjectContext, domain: String) async -> Poll? {
|
||||
guard
|
||||
let pollId = entity.poll?.id
|
||||
else { return nil }
|
||||
return try? await context.perform {
|
||||
let predicate = Poll.predicate(domain: domain, id: pollId)
|
||||
return Poll.findOrFetch(in: context, matching: predicate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user