Able to subscribe to realm

This commit is contained in:
2024-10-14 21:40:28 +08:00
parent 6f26a44838
commit 4d602220d2
6 changed files with 181 additions and 19 deletions

View File

@@ -491,3 +491,14 @@ func TruncatePostContent(post models.Post) models.Post {
return post
}
const TruncatePostContentShortThreshold = 80
func TruncatePostContentShort(content string) string {
length := TruncatePostContentShortThreshold
if len([]rune(content)) >= length {
return string([]rune(content)[:length]) + "..."
} else {
return content
}
}