[comment] fix unnecessary truncate when trimming

Also makes trimming consistent across themes
This commit is contained in:
discomrade 2024-02-20 03:02:43 +00:00 committed by Shish
parent e80d235fe9
commit d451f164a3
4 changed files with 20 additions and 4 deletions

View file

@ -209,7 +209,11 @@ class CommentListTheme extends Themelet
$i_uid = $comment->owner_id;
$h_name = html_escape($comment->owner_name);
$h_timestamp = autodate($comment->posted);
$h_comment = ($trim ? truncate($tfe->stripped, 50) : $tfe->formatted);
if ($trim) {
$h_comment = strlen($tfe->stripped) > 52 ? substr($tfe->stripped, 0, 50)."..." : $tfe->stripped;
} else {
$h_comment = $tfe->formatted;
}
$i_comment_id = $comment->comment_id;
$i_image_id = $comment->image_id;

View file

@ -103,7 +103,11 @@ class CustomCommentListTheme extends CommentListTheme
//$i_uid = $comment->owner_id;
$h_name = html_escape($comment->owner_name);
//$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
if ($trim) {
$h_comment = strlen($tfe->stripped) > 52 ? substr($tfe->stripped, 0, 50)."..." : $tfe->stripped;
} else {
$h_comment = $tfe->formatted;
}
$i_comment_id = $comment->comment_id;
$i_image_id = $comment->image_id;
$h_posted = autodate($comment->posted);

View file

@ -103,7 +103,11 @@ class CustomCommentListTheme extends CommentListTheme
//$i_uid = $comment->owner_id;
$h_name = html_escape($comment->owner_name);
//$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
if ($trim) {
$h_comment = strlen($tfe->stripped) > 52 ? substr($tfe->stripped, 0, 50)."..." : $tfe->stripped;
} else {
$h_comment = $tfe->formatted;
}
$i_comment_id = $comment->comment_id;
$i_image_id = $comment->image_id;
$h_posted = autodate($comment->posted);

View file

@ -77,7 +77,11 @@ class CustomCommentListTheme extends CommentListTheme
//$i_uid = $comment->owner_id;
$h_name = html_escape($comment->owner_name);
//$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
if ($trim) {
$h_comment = strlen($tfe->stripped) > 52 ? substr($tfe->stripped, 0, 50)."..." : $tfe->stripped;
} else {
$h_comment = $tfe->formatted;
}
$i_comment_id = $comment->comment_id;
$i_image_id = $comment->image_id;