You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Chore: Fix website build (#11359)
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { substrWithEllipsis } from '@joplin/lib/string-utils';
|
||||
import { msleep } from '@joplin/utils/time';
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
@ -141,3 +142,16 @@ export const createPost = async (topicId: number, post: any): Promise<ForumTopic
|
||||
export const updatePost = async (postId: number, content: any): Promise<void> => {
|
||||
await execApi(HttpMethod.PUT, `posts/${postId}.json`, content);
|
||||
};
|
||||
|
||||
export const trimPostToMaximumLength = (postBody: string) => {
|
||||
// Discourse has a maximum post length of 65_000:
|
||||
const maximumLength = 65_000;
|
||||
if (postBody.length > maximumLength) {
|
||||
return [
|
||||
substrWithEllipsis(postBody, 0, maximumLength - 150),
|
||||
'**Note**: The full content of this post is longer than permitted by Discourse.',
|
||||
].join('\n\n');
|
||||
}
|
||||
|
||||
return postBody;
|
||||
};
|
||||
|
Reference in New Issue
Block a user