mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-02-03 10:47:35 +01:00
Use correct domain to find users
This commit is contained in:
parent
3fc27936d6
commit
77bf1ab03d
@ -377,11 +377,11 @@ extension ProfileViewController {
|
|||||||
profileHeaderViewController.profileHeaderView.viewModel.viewDidAppear
|
profileHeaderViewController.profileHeaderView.viewModel.viewDidAppear
|
||||||
)
|
)
|
||||||
.sink { [weak self] (user, _) in
|
.sink { [weak self] (user, _) in
|
||||||
guard let self = self, let user = user else { return }
|
guard let self, let user else { return }
|
||||||
Task {
|
Task {
|
||||||
_ = try await self.context.apiService.fetchUser(
|
_ = try await self.context.apiService.fetchUser(
|
||||||
username: user.username,
|
username: user.username,
|
||||||
domain: user.domain,
|
domain: user.domainFromAcct,
|
||||||
authenticationBox: self.authContext.mastodonAuthenticationBox
|
authenticationBox: self.authContext.mastodonAuthenticationBox
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
import CoreData
|
import CoreData
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
/// See also `CoreDataStack.MastodonUser`, this extension contains several
|
||||||
final public class MastodonUser: NSManagedObject {
|
final public class MastodonUser: NSManagedObject {
|
||||||
|
|
||||||
public typealias ID = String
|
public typealias ID = String
|
||||||
|
@ -201,8 +201,9 @@ extension APIService {
|
|||||||
|
|
||||||
// user
|
// user
|
||||||
let managedObjectContext = self.backgroundManagedObjectContext
|
let managedObjectContext = self.backgroundManagedObjectContext
|
||||||
|
var result: MastodonUser?
|
||||||
try await managedObjectContext.performChanges {
|
try await managedObjectContext.performChanges {
|
||||||
_ = Persistence.MastodonUser.createOrMerge(
|
result = Persistence.MastodonUser.createOrMerge(
|
||||||
in: managedObjectContext,
|
in: managedObjectContext,
|
||||||
context: Persistence.MastodonUser.PersistContext(
|
context: Persistence.MastodonUser.PersistContext(
|
||||||
domain: domain,
|
domain: domain,
|
||||||
@ -210,18 +211,9 @@ extension APIService {
|
|||||||
cache: nil,
|
cache: nil,
|
||||||
networkDate: response.networkDate
|
networkDate: response.networkDate
|
||||||
)
|
)
|
||||||
)
|
).user
|
||||||
}
|
|
||||||
var result: MastodonUser?
|
|
||||||
try await managedObjectContext.perform {
|
|
||||||
result = Persistence.MastodonUser.fetch(in: managedObjectContext,
|
|
||||||
context: Persistence.MastodonUser.PersistContext(
|
|
||||||
domain: domain,
|
|
||||||
entity: response.value,
|
|
||||||
cache: nil,
|
|
||||||
networkDate: response.networkDate
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user