Page MenuHomePhorge

D5715.1765327870.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D5715.1765327870.diff

diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js
--- a/lib/shared/markdown.js
+++ b/lib/shared/markdown.js
@@ -252,6 +252,10 @@
const spoilerRegex: RegExp = /^\|\|([^\n]+?)\|\|/g;
+function hideSpoilerText(text: string): string {
+ return text.replace(/\|\|(.+?)\|\|/g, '⬛⬛⬛');
+}
+
export {
paragraphRegex,
paragraphStripTrailingNewlineRegex,
@@ -272,4 +276,5 @@
matchList,
parseList,
matchMentions,
+ hideSpoilerText,
};
diff --git a/lib/shared/messages/text-message-spec.js b/lib/shared/messages/text-message-spec.js
--- a/lib/shared/messages/text-message-spec.js
+++ b/lib/shared/messages/text-message-spec.js
@@ -16,7 +16,7 @@
import type { NotifTexts } from '../../types/notif-types';
import type { ThreadInfo } from '../../types/thread-types';
import type { RelativeUserInfo } from '../../types/user-types';
-import { type ASTNode, type SingleASTNode } from '../markdown';
+import { type ASTNode, type SingleASTNode, hideSpoilerText } from '../markdown';
import { threadIsGroupChat } from '../thread-utils';
import { stringForUser } from '../user-utils';
import type {
@@ -84,9 +84,9 @@
messageTitle({ messageInfo, markdownRules }) {
const { text } = messageInfo;
+ const textWithoutSpoilers = hideSpoilerText(text);
const parser = SimpleMarkdown.parserFor(markdownRules);
- const ast = parser(text, { disableAutoBlockNewlines: true });
-
+ const ast = parser(textWithoutSpoilers, { disableAutoBlockNewlines: true });
return getFirstNonQuotedRawLine(ast).trim();
},

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 10, 12:51 AM (10 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5859359
Default Alt Text
D5715.1765327870.diff (1 KB)

Event Timeline