diff --git a/lib/shared/messages/change-role-message-spec.js b/lib/shared/messages/change-role-message-spec.js --- a/lib/shared/messages/change-role-message-spec.js +++ b/lib/shared/messages/change-role-message-spec.js @@ -15,6 +15,11 @@ import type { NotifTexts } from '../../types/notif-types'; import type { ThreadInfo } from '../../types/thread-types'; import type { RelativeUserInfo } from '../../types/user-types'; +import { + ET, + type EntityText, + pluralizeEntityText, +} from '../../utils/entity-text'; import { values } from '../../utils/objects'; import { robotextToRawString, @@ -131,21 +136,25 @@ robotext( messageInfo: ChangeRoleMessageInfo, - creator: string, + creatorString: string, params: RobotextParams, - ): string { + ): EntityText { const users = messageInfo.members; invariant(users.length !== 0, 'changed whose role??'); - const usersString = params.robotextForUsers(users); + + const creator = ET.user({ userInfo: messageInfo.creator }); + const affectedUsers = pluralizeEntityText( + users.map(user => ET`${ET.user({ userInfo: user })}`), + ); const { threadInfo } = params; invariant(threadInfo, 'ThreadInfo should be set for CHANGE_ROLE message'); const verb = threadInfo.roles[messageInfo.newRole].isDefault ? 'removed' : 'added'; - const noun = users.length === 1 ? 'an admin' : 'admins'; - return `${creator} ${verb} ${usersString} as ${noun}`; + + return ET`${creator} ${verb} ${affectedUsers} as ${noun}`; }, notificationTexts(