diff --git a/lib/shared/messages/create-entry-message-spec.js b/lib/shared/messages/create-entry-message-spec.js --- a/lib/shared/messages/create-entry-message-spec.js +++ b/lib/shared/messages/create-entry-message-spec.js @@ -16,6 +16,7 @@ import type { ThreadInfo } from '../../types/thread-types'; import type { RelativeUserInfo } from '../../types/user-types'; import { prettyDate } from '../../utils/date-utils'; +import { ET, type EntityText } from '../../utils/entity-text'; import { robotextToRawString, robotextForMessageInfo, @@ -123,12 +124,11 @@ return { ...messageData, id }; }, - robotext(messageInfo: CreateEntryMessageInfo, creator: string): string { + robotext(messageInfo: CreateEntryMessageInfo): EntityText { const date = prettyDate(messageInfo.date); - return ( - `${creator} created an event scheduled for ${date}: ` + - `"${encodeURI(messageInfo.text)}"` - ); + const creator = ET.user({ userInfo: messageInfo.creator }); + const { text } = messageInfo; + return ET`${creator} created an event scheduled for ${date}: "${text}"`; }, notificationTexts( diff --git a/lib/shared/messages/delete-entry-message-spec.js b/lib/shared/messages/delete-entry-message-spec.js --- a/lib/shared/messages/delete-entry-message-spec.js +++ b/lib/shared/messages/delete-entry-message-spec.js @@ -16,6 +16,7 @@ import type { ThreadInfo } from '../../types/thread-types'; import type { RelativeUserInfo } from '../../types/user-types'; import { prettyDate } from '../../utils/date-utils'; +import { ET, type EntityText } from '../../utils/entity-text'; import { robotextToRawString, robotextForMessageInfo, @@ -123,12 +124,11 @@ return { ...messageData, id }; }, - robotext(messageInfo: DeleteEntryMessageInfo, creator: string): string { + robotext(messageInfo: DeleteEntryMessageInfo): EntityText { const date = prettyDate(messageInfo.date); - return ( - `${creator} deleted an event scheduled for ${date}: ` + - `"${encodeURI(messageInfo.text)}"` - ); + const creator = ET.user({ userInfo: messageInfo.creator }); + const { text } = messageInfo; + return ET`${creator} deleted an event scheduled for ${date}: "${text}"`; }, notificationTexts( diff --git a/lib/shared/messages/edit-entry-message-spec.js b/lib/shared/messages/edit-entry-message-spec.js --- a/lib/shared/messages/edit-entry-message-spec.js +++ b/lib/shared/messages/edit-entry-message-spec.js @@ -16,6 +16,7 @@ import type { ThreadInfo } from '../../types/thread-types'; import type { RelativeUserInfo } from '../../types/user-types'; import { prettyDate } from '../../utils/date-utils'; +import { ET, type EntityText } from '../../utils/entity-text'; import { robotextToRawString, robotextForMessageInfo, @@ -123,12 +124,11 @@ return { ...messageData, id }; }, - robotext(messageInfo: EditEntryMessageInfo, creator: string): string { + robotext(messageInfo: EditEntryMessageInfo): EntityText { const date = prettyDate(messageInfo.date); - return ( - `${creator} updated the text of an event scheduled for ` + - `${date}: "${encodeURI(messageInfo.text)}"` - ); + const creator = ET.user({ userInfo: messageInfo.creator }); + const { text } = messageInfo; + return ET`${creator} updated the text of an event scheduled for ${date}: "${text}"`; }, notificationTexts( diff --git a/lib/shared/messages/restore-entry-message-spec.js b/lib/shared/messages/restore-entry-message-spec.js --- a/lib/shared/messages/restore-entry-message-spec.js +++ b/lib/shared/messages/restore-entry-message-spec.js @@ -16,6 +16,7 @@ import type { ThreadInfo } from '../../types/thread-types'; import type { RelativeUserInfo } from '../../types/user-types'; import { prettyDate } from '../../utils/date-utils'; +import { ET, type EntityText } from '../../utils/entity-text'; import { robotextToRawString, robotextForMessageInfo, @@ -123,12 +124,11 @@ return { ...messageData, id }; }, - robotext(messageInfo: RestoreEntryMessageInfo, creator: string): string { + robotext(messageInfo: RestoreEntryMessageInfo): EntityText { const date = prettyDate(messageInfo.date); - return ( - `${creator} restored an event scheduled for ${date}: ` + - `"${encodeURI(messageInfo.text)}"` - ); + const creator = ET.user({ userInfo: messageInfo.creator }); + const { text } = messageInfo; + return ET`${creator} restored an event scheduled for ${date}: "${text}"`; }, notificationTexts(