The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/definition/IMessage/IMessage.ts

86 lines
1.8 KiB

import { MessageSurfaceLayout } from '@rocket.chat/ui-kit';
import { parser } from '@rocket.chat/message-parser';
import type { IRocketChatRecord } from '../IRocketChatRecord';
import type { IUser } from '../IUser';
import type { ChannelName, RoomID } from '../IRoom';
import type { MessageAttachment } from './MessageAttachment/MessageAttachment';
import type { FileProp } from './MessageAttachment/Files/FileProp';
type MentionType = 'user' | 'team';
type MessageTypesValues =
| 'e2e'
| 'uj'
| 'ul'
| 'ru'
| 'au'
| 'mute_unmute'
| 'r'
| 'ut'
| 'wm'
| 'rm'
| 'subscription-role-added'
| 'subscription-role-removed'
| 'room_archived'
| 'room_unarchived'
| 'room_changed_privacy'
| 'room_changed_avatar'
| 'room_changed_topic'
| 'room_e2e_enabled'
| 'room_e2e_disabled'
| 'livechat-close'
export interface IMessage extends IRocketChatRecord {
rid: RoomID;
msg: string;
tmid?: string;
ts: Date;
mentions?: {
_id: string;
type: MentionType;
name?: string;
username?: string;
}[];
groupable?: false;
channels?: Array<ChannelName>;
u: Pick<IUser, '_id' | 'username' | 'name'>;
blocks?: MessageSurfaceLayout;
alias?: string;
md?: ReturnType<typeof parser>;
_hidden?: boolean;
imported?: boolean;
replies?: IUser['_id'][];
location?: {
type: 'Point';
coordinates: [string, string];
};
starred?: {_id: IUser['_id']}[];
pinned?: boolean;
drid?: RoomID;
tlm?: Date;
dcount?: number;
tcount?: number;
t?: MessageTypesValues;
e2e?: 'pending';
urls: any;
/** @deprecated Deprecated in favor of files */
file?: FileProp;
files?: FileProp[];
attachments?: MessageAttachment[];
}
export type IMessageInbox = IMessage & {
// email inbox fields
email?: {
references?: string[];
messageId?: string;
};
}
export const isIMessageInbox = (message: IMessage): message is IMessageInbox => 'email' in message;