mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Fix formatting error in !cases with long code blocks
This commit is contained in:
parent
797de39dac
commit
5ffc3e7cc4
1 changed files with 3 additions and 3 deletions
|
@ -16,6 +16,7 @@ import { humanizeDurationShort } from "../../../humanizeDurationShort";
|
||||||
import { caseAbbreviations } from "../caseAbbreviations";
|
import { caseAbbreviations } from "../caseAbbreviations";
|
||||||
import { getCaseIcon } from "./getCaseIcon";
|
import { getCaseIcon } from "./getCaseIcon";
|
||||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||||
|
import { splitIntoCleanChunks, splitMessageIntoChunks } from "knub/dist/helpers";
|
||||||
|
|
||||||
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;
|
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;
|
||||||
const INCLUDE_MORE_NOTES_THRESHOLD = 20;
|
const INCLUDE_MORE_NOTES_THRESHOLD = 20;
|
||||||
|
@ -49,9 +50,8 @@ export async function getCaseSummary(
|
||||||
if (reason.length > CASE_SUMMARY_REASON_MAX_LENGTH) {
|
if (reason.length > CASE_SUMMARY_REASON_MAX_LENGTH) {
|
||||||
const match = reason.slice(CASE_SUMMARY_REASON_MAX_LENGTH, 100).match(/(?:[.,!?\s]|$)/);
|
const match = reason.slice(CASE_SUMMARY_REASON_MAX_LENGTH, 100).match(/(?:[.,!?\s]|$)/);
|
||||||
const nextWhitespaceIndex = match ? CASE_SUMMARY_REASON_MAX_LENGTH + match.index! : CASE_SUMMARY_REASON_MAX_LENGTH;
|
const nextWhitespaceIndex = match ? CASE_SUMMARY_REASON_MAX_LENGTH + match.index! : CASE_SUMMARY_REASON_MAX_LENGTH;
|
||||||
if (nextWhitespaceIndex < reason.length) {
|
const reasonChunks = splitMessageIntoChunks(reason, nextWhitespaceIndex);
|
||||||
reason = reason.slice(0, nextWhitespaceIndex - 1) + "...";
|
reason = reasonChunks[0] + "...";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reason = disableLinkPreviews(reason);
|
reason = disableLinkPreviews(reason);
|
||||||
|
|
Loading…
Add table
Reference in a new issue