Fix missing poll information (IOS-201)
This commit is contained in:
parent
69a92c3d0f
commit
7323cb9d08
@ -284,7 +284,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
|
|||||||
contentWarning = status.entity.spoilerText ?? ""
|
contentWarning = status.entity.spoilerText ?? ""
|
||||||
}
|
}
|
||||||
Task {
|
Task {
|
||||||
if let poll = await status.getPoll(in: context.managedObjectContext) {
|
if let poll = await status.getPoll(in: context.managedObjectContext, domain: authContext.mastodonAuthenticationBox.domain) {
|
||||||
isPollActive = !poll.expired
|
isPollActive = !poll.expired
|
||||||
pollMultipleConfigurationOption = poll.multiple
|
pollMultipleConfigurationOption = poll.multiple
|
||||||
if let pollExpiresAt = poll.expiresAt {
|
if let pollExpiresAt = poll.expiresAt {
|
||||||
|
@ -362,12 +362,13 @@ extension StatusView {
|
|||||||
|
|
||||||
private func configurePoll(status: MastodonStatus) {
|
private func configurePoll(status: MastodonStatus) {
|
||||||
Task {
|
Task {
|
||||||
|
let status = status.reblog ?? status
|
||||||
|
|
||||||
guard
|
guard
|
||||||
let context = viewModel.context?.managedObjectContext,
|
let context = viewModel.context?.managedObjectContext,
|
||||||
let poll = await status.getPoll(in: context)
|
let poll = await status.getPoll(in: context, domain: viewModel.authContext?.mastodonAuthenticationBox.domain ?? "")
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
let status = status.reblog ?? status
|
|
||||||
|
|
||||||
viewModel.managedObjects.insert(poll)
|
viewModel.managedObjects.insert(poll)
|
||||||
|
|
||||||
@ -507,9 +508,8 @@ extension StatusView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension MastodonStatus {
|
extension MastodonStatus {
|
||||||
func getPoll(in context: NSManagedObjectContext) async -> Poll? {
|
func getPoll(in context: NSManagedObjectContext, domain: String) async -> Poll? {
|
||||||
guard
|
guard
|
||||||
let domain = entity.account.domain,
|
|
||||||
let pollId = entity.poll?.id
|
let pollId = entity.poll?.id
|
||||||
else { return nil }
|
else { return nil }
|
||||||
return try? await context.perform {
|
return try? await context.perform {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user