chore: remove report comment suffix
This commit is contained in:
parent
4e83be76c4
commit
eef960dae4
|
@ -125,40 +125,12 @@ extension ReportViewModel {
|
||||||
// the user comment is essential step in report flow
|
// the user comment is essential step in report flow
|
||||||
// only check isSkip or not
|
// only check isSkip or not
|
||||||
let comment: String? = {
|
let comment: String? = {
|
||||||
var suffixes: [String] = []
|
let _comment = self.reportSupplementaryViewModel.isSkip ? nil : self.reportSupplementaryViewModel.commentContext.comment
|
||||||
let content: String?
|
if let comment = _comment, !comment.isEmpty {
|
||||||
|
return comment
|
||||||
// the server rules is NOT essential step in report flow
|
} else {
|
||||||
// append suffix depends which reason
|
return nil
|
||||||
if let reason = self.reportReasonViewModel.selectReason {
|
|
||||||
switch reason {
|
|
||||||
case .spam:
|
|
||||||
suffixes.append(reason.rawValue)
|
|
||||||
case .violateRule:
|
|
||||||
suffixes.append(reason.rawValue)
|
|
||||||
|
|
||||||
for rule in self.reportServerRulesViewModel.selectRules {
|
|
||||||
suffixes.append(rule.text)
|
|
||||||
}
|
}
|
||||||
case .dislike:
|
|
||||||
assertionFailure("should not enter the report flow")
|
|
||||||
case .other:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
content = self.reportSupplementaryViewModel.isSkip ? nil : self.reportSupplementaryViewModel.commentContext.comment
|
|
||||||
|
|
||||||
let suffix: String? = {
|
|
||||||
let text = suffixes.joined(separator: ". ")
|
|
||||||
guard !text.isEmpty else { return nil }
|
|
||||||
return "<" + text + ">"
|
|
||||||
}()
|
|
||||||
|
|
||||||
let comment = [content, suffix]
|
|
||||||
.compactMap { $0 }
|
|
||||||
.joined(separator: " ")
|
|
||||||
return comment.isEmpty ? nil : comment
|
|
||||||
}()
|
}()
|
||||||
return Mastodon.API.Reports.FileReportQuery(
|
return Mastodon.API.Reports.FileReportQuery(
|
||||||
accountID: user.id,
|
accountID: user.id,
|
||||||
|
|
Loading…
Reference in New Issue