mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-01-31 17:45:17 +01:00
Use account to determine status-visibility (IOS-192)
This commit is contained in:
parent
c152c7b3c7
commit
4764116efc
@ -156,7 +156,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
|
|||||||
self.visibility = {
|
self.visibility = {
|
||||||
// default private when user locked
|
// default private when user locked
|
||||||
var visibility: Mastodon.Entity.Status.Visibility = {
|
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 .public
|
||||||
}
|
}
|
||||||
return author.locked ? .private : .public
|
return author.locked ? .private : .public
|
||||||
@ -196,7 +196,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
|
|||||||
case .reply(let record):
|
case .reply(let record):
|
||||||
context.managedObjectContext.performAndWait {
|
context.managedObjectContext.performAndWait {
|
||||||
let status = record.entity
|
let status = record.entity
|
||||||
let author = authContext.mastodonAuthenticationBox.authentication.user(in: context.managedObjectContext)
|
let author = authContext.mastodonAuthenticationBox.authentication.account()
|
||||||
|
|
||||||
var mentionAccts: [String] = []
|
var mentionAccts: [String] = []
|
||||||
if author?.id != status.account.id {
|
if author?.id != status.account.id {
|
||||||
@ -603,12 +603,7 @@ extension ComposeContentViewModel {
|
|||||||
guard case let .editStatus(status, _) = composeContext else { return nil }
|
guard case let .editStatus(status, _) = composeContext else { return nil }
|
||||||
|
|
||||||
// author
|
// author
|
||||||
let managedObjectContext = self.context.managedObjectContext
|
guard let author = authContext.mastodonAuthenticationBox.authentication.account() else {
|
||||||
var _author: ManagedObjectRecord<MastodonUser>?
|
|
||||||
managedObjectContext.performAndWait {
|
|
||||||
_author = authContext.mastodonAuthenticationBox.authentication.user(in: managedObjectContext)?.asRecord
|
|
||||||
}
|
|
||||||
guard let author = _author else {
|
|
||||||
throw AppError.badAuthentication
|
throw AppError.badAuthentication
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user