forked from shadowfacts/Tusker
Fix content warning not being copied when replying
This commit is contained in:
parent
184fe49c0f
commit
99db842411
|
@ -120,12 +120,28 @@ extension MastodonController {
|
|||
var acctsToMention = [String]()
|
||||
|
||||
var visibility = Preferences.shared.defaultPostVisibility
|
||||
var contentWarning = ""
|
||||
|
||||
if let inReplyToID = inReplyToID,
|
||||
let inReplyTo = persistentContainer.status(for: inReplyToID) {
|
||||
acctsToMention.append(inReplyTo.account.acct)
|
||||
acctsToMention.append(contentsOf: inReplyTo.mentions.map(\.acct))
|
||||
visibility = inReplyTo.visibility
|
||||
|
||||
if !inReplyTo.spoilerText.isEmpty {
|
||||
switch Preferences.shared.contentWarningCopyMode {
|
||||
case .doNotCopy:
|
||||
break
|
||||
case .asIs:
|
||||
contentWarning = inReplyTo.spoilerText
|
||||
case .prependRe:
|
||||
if inReplyTo.spoilerText.lowercased().starts(with: "re:") {
|
||||
contentWarning = inReplyTo.spoilerText
|
||||
} else {
|
||||
contentWarning = "re: \(inReplyTo.spoilerText)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let mentioningAcct = mentioningAcct {
|
||||
acctsToMention.append(mentioningAcct)
|
||||
|
@ -140,6 +156,8 @@ extension MastodonController {
|
|||
draft.text = acctsToMention.map { "@\($0) " }.joined()
|
||||
draft.initialText = draft.text
|
||||
draft.visibility = visibility
|
||||
draft.contentWarning = contentWarning
|
||||
draft.contentWarningEnabled = !contentWarning.isEmpty
|
||||
return draft
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue