fix: prefer the original mode to top-two-tier tree mode

This commit is contained in:
CMK 2022-11-18 00:16:21 +08:00
parent 1ca3b66e40
commit b5d883865d
1 changed files with 14 additions and 6 deletions

View File

@ -92,19 +92,27 @@ extension ThreadViewModel.LoadThreadState {
from: response.value.ancestors from: response.value.ancestors
) )
) )
// deprecated: Tree mode replies
// viewModel.mastodonStatusThreadViewModel.appendDescendant(
// domain: threadContext.domain,
// nodes: MastodonStatusThreadViewModel.Node.children(
// of: threadContext.statusID,
// from: response.value.descendants
// )
// )
// new: the same order from API
viewModel.mastodonStatusThreadViewModel.appendDescendant( viewModel.mastodonStatusThreadViewModel.appendDescendant(
domain: threadContext.domain, domain: threadContext.domain,
nodes: MastodonStatusThreadViewModel.Node.children( nodes: response.value.descendants.map { status in
of: threadContext.statusID, return .init(statusID: status.id, children: [])
from: response.value.descendants }
)
) )
} catch { } catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch status context for \(threadContext.statusID) fail: \(error.localizedDescription)") logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch status context for \(threadContext.statusID) fail: \(error.localizedDescription)")
await enter(state: Fail.self) await enter(state: Fail.self)
} }
} // end Task
}
} }
} }