generated from nhcarrigan/template
feat: Multiple Features, Accessibility, Security, and UX Improvements #59
@@ -224,11 +224,12 @@ export class ActivityService {
|
|||||||
entityTitle = comment.manga.title;
|
entityTitle = comment.manga.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get first 100 characters of comment
|
// Strip HTML tags and get first 100 characters of comment
|
||||||
|
const plainText = this.stripHtml(comment.content);
|
||||||
const commentPreview =
|
const commentPreview =
|
||||||
comment.content.length > 100
|
plainText.length > 100
|
||||||
? `${comment.content.slice(0, 100)}...`
|
? `${plainText.slice(0, 100)}...`
|
||||||
: comment.content;
|
: plainText;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: `comment-${comment.id}`,
|
id: `comment-${comment.id}`,
|
||||||
@@ -350,4 +351,11 @@ export class ActivityService {
|
|||||||
return "Unknown Item";
|
return "Unknown Item";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strip HTML tags from content for plain text preview.
|
||||||
|
*/
|
||||||
|
private stripHtml(html: string): string {
|
||||||
|
return html.replace(/<[^>]*>/g, "").trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user