diff --git a/MastodonSDK/Sources/MastodonSDK/MastodonStatus.swift b/MastodonSDK/Sources/MastodonSDK/MastodonStatus.swift index ab4103eaa..5f6112da2 100644 --- a/MastodonSDK/Sources/MastodonSDK/MastodonStatus.swift +++ b/MastodonSDK/Sources/MastodonSDK/MastodonStatus.swift @@ -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) + } + } +} diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+Configuration.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+Configuration.swift index 1818becaf..2c98fa4e1 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+Configuration.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+Configuration.swift @@ -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) - } - } -}