fix(Mention): Fixes an issue where user Profiles are not found because matching is not done via href (#895)

This commit is contained in:
Marcus Kida 2023-01-19 13:47:16 +01:00 committed by GitHub
parent 3ec9e603df
commit c0cd51c0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -66,15 +66,19 @@ extension DataSourceFacade {
) async {
let domain = provider.authContext.mastodonAuthenticationBox.domain
let href = userInfo?["href"] as? String
guard let url = href.flatMap({ URL(string: $0) }) else { return }
guard
let href = userInfo?["href"] as? String,
let url = URL(string: href)
else {
return
}
let managedObjectContext = provider.context.managedObjectContext
let mentions = try? await managedObjectContext.perform {
return status.object(in: managedObjectContext)?.mentions ?? []
}
guard let mention = mentions?.first(where: { $0.username == mention }) else {
guard let mention = mentions?.first(where: { $0.url == href }) else {
_ = await provider.coordinator.present(
scene: .safari(url: url),
from: provider,