mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 12:35:50 +02:00
feat: support the magic break string '[...]' in content, such that if found, outbound federation will use all content up to (and including) that string in its summary
This commit is contained in:
@@ -755,6 +755,11 @@ Mocks.notes.public = async (post) => {
|
|||||||
// attachment,
|
// attachment,
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
const breakString = '[...]';
|
||||||
|
if (post.content.includes(breakString)) {
|
||||||
|
const index = post.content.indexOf(breakString);
|
||||||
|
summary = post.content.slice(0, index + breakString.length);
|
||||||
|
} else {
|
||||||
const sentences = tokenizer.sentences(post.content, { newline_boundaries: true });
|
const sentences = tokenizer.sentences(post.content, { newline_boundaries: true });
|
||||||
// Append sentences to summary until it contains just under 500 characters of content
|
// Append sentences to summary until it contains just under 500 characters of content
|
||||||
const limit = 500;
|
const limit = 500;
|
||||||
@@ -779,6 +784,7 @@ Mocks.notes.public = async (post) => {
|
|||||||
|
|
||||||
return memo;
|
return memo;
|
||||||
}, '');
|
}, '');
|
||||||
|
}
|
||||||
|
|
||||||
// Final sanitization to clean up tags
|
// Final sanitization to clean up tags
|
||||||
summary = posts.sanitize(summary);
|
summary = posts.sanitize(summary);
|
||||||
|
|||||||
Reference in New Issue
Block a user