Post length is counted differently from server (see #1439) (#1440)

Mastodon server replaces all URLs with a 23 character string, not just those that are longer than 23 characters
This commit is contained in:
nathanwale 2023-06-26 19:46:04 +10:00 committed by GitHub
parent 044d3b6b84
commit abcd63a136
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,7 +178,6 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
multiple: pollVotingFrequency.canVoteMultipleTimes,
expires_in: pollDuration.rawValue)
}
let data = StatusData(status: statusText.string,
visibility: visibility,
inReplyToId: mode.replyToStatus?.id,
@ -342,10 +341,8 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
var numUrls = 0
for range in urlRanges {
if range.length > maxLengthOfUrl {
numUrls += 1
totalUrlLength += range.length
}
numUrls += 1
totalUrlLength += range.length
statusText.addAttributes([.foregroundColor: UIColor(theme?.tintColor ?? .brand),
.underlineStyle: NSUnderlineStyle.single.rawValue,