Fix composition mention population

This commit is contained in:
Justin Mazzocchi 2021-02-06 13:26:42 -08:00
parent ee4c7bafdb
commit 65b95e1510
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
2 changed files with 13 additions and 1 deletions

View file

@ -65,7 +65,17 @@ public final class NewStatusViewModel: ObservableObject {
} }
if let inReplyTo = inReplyTo, redraft == nil { if let inReplyTo = inReplyTo, redraft == nil {
compositionViewModel.text = inReplyTo.accountName.appending(" ") var mentions = Set<String>()
if !inReplyTo.isMine {
mentions.insert(inReplyTo.accountName)
}
mentions.formUnion(inReplyTo.mentions.map(\.acct)
.filter { $0 != identityContext.identity.account?.username }
.map("@".appending))
compositionViewModel.text = mentions.joined(separator: " ").appending(" ")
} }
compositionViewModels = [compositionViewModel] compositionViewModels = [compositionViewModel]

View file

@ -108,6 +108,8 @@ public extension StatusViewModel {
return URL(string: website) return URL(string: website)
} }
var mentions: [Mention] { statusService.status.displayStatus.mentions }
var visibility: Status.Visibility { statusService.status.displayStatus.visibility } var visibility: Status.Visibility { statusService.status.displayStatus.visibility }
var repliesCount: Int { statusService.status.displayStatus.repliesCount } var repliesCount: Int { statusService.status.displayStatus.repliesCount }