Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/messages/text-message-spec.js
Show All 14 Lines | |||||
} from '../../types/messages/text'; | } from '../../types/messages/text'; | ||||
import type { NotifTexts } from '../../types/notif-types'; | import type { NotifTexts } from '../../types/notif-types'; | ||||
import type { ThreadInfo } from '../../types/thread-types'; | import type { ThreadInfo } from '../../types/thread-types'; | ||||
import type { RelativeUserInfo } from '../../types/user-types'; | import type { RelativeUserInfo } from '../../types/user-types'; | ||||
import { | import { | ||||
type ASTNode, | type ASTNode, | ||||
type SingleASTNode, | type SingleASTNode, | ||||
stripSpoilersFromNotifications, | stripSpoilersFromNotifications, | ||||
stripSpoilersFromMarkdownAST, | |||||
} from '../markdown'; | } from '../markdown'; | ||||
import { threadIsGroupChat } from '../thread-utils'; | import { threadIsGroupChat } from '../thread-utils'; | ||||
import { stringForUser } from '../user-utils'; | import { stringForUser } from '../user-utils'; | ||||
import type { | import type { | ||||
MessageSpec, | MessageSpec, | ||||
NotificationTextsParams, | NotificationTextsParams, | ||||
RawMessageInfoFromServerDBRowParams, | RawMessageInfoFromServerDBRowParams, | ||||
} from './message-spec'; | } from './message-spec'; | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | > = Object.freeze({ | ||||
messageContentForClientDB(data: RawTextMessageInfo): string { | messageContentForClientDB(data: RawTextMessageInfo): string { | ||||
return this.messageContentForServerDB(data); | return this.messageContentForServerDB(data); | ||||
}, | }, | ||||
messageTitle({ messageInfo, markdownRules }) { | messageTitle({ messageInfo, markdownRules }) { | ||||
const { text } = messageInfo; | const { text } = messageInfo; | ||||
const parser = SimpleMarkdown.parserFor(markdownRules); | const parser = SimpleMarkdown.parserFor(markdownRules); | ||||
const ast = parser(text, { disableAutoBlockNewlines: true }); | const ast = stripSpoilersFromMarkdownAST( | ||||
parser(text, { disableAutoBlockNewlines: true }), | |||||
); | |||||
return getFirstNonQuotedRawLine(ast).trim(); | return getFirstNonQuotedRawLine(ast).trim(); | ||||
}, | }, | ||||
rawMessageInfoFromServerDBRow( | rawMessageInfoFromServerDBRow( | ||||
row: Object, | row: Object, | ||||
params: RawMessageInfoFromServerDBRowParams, | params: RawMessageInfoFromServerDBRowParams, | ||||
): RawTextMessageInfo { | ): RawTextMessageInfo { | ||||
const rawTextMessageInfo: RawTextMessageInfo = { | const rawTextMessageInfo: RawTextMessageInfo = { | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |