🐛 Fix the included post did not truncated
This commit is contained in:
parent
700c818df8
commit
bcd107ae2c
@ -25,9 +25,25 @@ public class PostService(
|
|||||||
const int maxLength = 256;
|
const int maxLength = 256;
|
||||||
foreach (var item in input)
|
foreach (var item in input)
|
||||||
{
|
{
|
||||||
if (!(item.Content?.Length > maxLength)) continue;
|
if (item.Content?.Length > maxLength)
|
||||||
item.Content = item.Content[..maxLength];
|
{
|
||||||
item.IsTruncated = true;
|
item.Content = item.Content[..maxLength];
|
||||||
|
item.IsTruncated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Truncate replied post content
|
||||||
|
if (item.RepliedPost?.Content?.Length > maxLength)
|
||||||
|
{
|
||||||
|
item.RepliedPost.Content = item.RepliedPost.Content[..maxLength];
|
||||||
|
item.RepliedPost.IsTruncated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Truncate forwarded post content
|
||||||
|
if (item.ForwardedPost?.Content?.Length > maxLength)
|
||||||
|
{
|
||||||
|
item.ForwardedPost.Content = item.ForwardedPost.Content[..maxLength];
|
||||||
|
item.ForwardedPost.IsTruncated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user