Double-check that post language and rtl property are set on publishing

This commit is contained in:
Angelo Stavrow 2020-09-16 13:47:30 -04:00
parent c9df320ddd
commit 7ae7c57442
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -83,6 +83,13 @@ extension WriteFreelyModel {
func publish(post: WFAPost) {
guard let loggedInClient = client else { return }
if post.language == nil {
if let languageCode = Locale.current.languageCode {
post.language = languageCode
post.rtl = Locale.characterDirection(forLanguage: languageCode) == .rightToLeft
}
}
var wfPost = WFPost(
body: post.body,
title: post.title.isEmpty ? "" : post.title,