Skip to content
Snippets Groups Projects
Commit 270c64c1 authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #5355 from RocketChat/allow-alias-send-file-message

Allow alias, avatar, and emoji in the sendFileMessage.
parents 3a0d0deb 3dac1d51
No related branches found
No related tags found
No related merge requests found
Meteor.methods({
'sendFileMessage'(roomId, store, file) {
'sendFileMessage'(roomId, store, file, msgData = {}) {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'sendFileMessage' });
}
......@@ -10,6 +10,14 @@ Meteor.methods({
return false;
}
check(msgData, {
avatar: Match.Optional(String),
emoji: Match.Optional(String),
alias: Match.Optional(String),
groupable: Match.Optional(Boolean),
msg: Match.Optional(String)
});
RocketChat.models.Uploads.updateFileComplete(file._id, Meteor.userId(), _.omit(file, '_id'));
var fileUrl = '/file-upload/' + file._id + '/' + file.name;
......@@ -37,7 +45,7 @@ Meteor.methods({
attachment.video_size = file.size;
}
const msg = {
const msg = Object.assign({
_id: Random.id(),
rid: roomId,
msg: '',
......@@ -46,7 +54,7 @@ Meteor.methods({
},
groupable: false,
attachments: [attachment]
};
}, msgData);
return Meteor.call('sendMessage', msg);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment