Use account to determine status-visibility (IOS-192)

This commit is contained in:
Nathan Mattes 2024-01-01 20:10:00 +01:00
parent c152c7b3c7
commit 4764116efc
1 changed files with 3 additions and 8 deletions

View File

@ -156,7 +156,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
self.visibility = {
// default private when user locked
var visibility: Mastodon.Entity.Status.Visibility = {
guard let author = authContext.mastodonAuthenticationBox.authentication.user(in: context.managedObjectContext) else {
guard let author = authContext.mastodonAuthenticationBox.authentication.account() else {
return .public
}
return author.locked ? .private : .public
@ -196,7 +196,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
case .reply(let record):
context.managedObjectContext.performAndWait {
let status = record.entity
let author = authContext.mastodonAuthenticationBox.authentication.user(in: context.managedObjectContext)
let author = authContext.mastodonAuthenticationBox.authentication.account()
var mentionAccts: [String] = []
if author?.id != status.account.id {
@ -603,12 +603,7 @@ extension ComposeContentViewModel {
guard case let .editStatus(status, _) = composeContext else { return nil }
// author
let managedObjectContext = self.context.managedObjectContext
var _author: ManagedObjectRecord<MastodonUser>?
managedObjectContext.performAndWait {
_author = authContext.mastodonAuthenticationBox.authentication.user(in: managedObjectContext)?.asRecord
}
guard let author = _author else {
guard let author = authContext.mastodonAuthenticationBox.authentication.account() else {
throw AppError.badAuthentication
}