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/apps/meteor/client/lib/mutationEffects/updatePinMessage.ts

19 lines
556 B

import type { IMessage } from '@rocket.chat/core-typings';
import { Messages } from '../../stores';
import { PinMessagesNotAllowed } from '../errors/PinMessagesNotAllowed';
export const updatePinMessage = (message: IMessage, data: Partial<IMessage>) => {
const msg = Messages.state.get(message._id);
if (!msg) {
throw new PinMessagesNotAllowed('Error pinning message', {
method: 'pinMessage',
});
}
Messages.state.update(
(record) => record._id === message._id && record.rid === message.rid,
(record) => ({ ...record, ...data }),
);
};