We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d50ffb commit 1b58035Copy full SHA for 1b58035
api/server/methods.ts
@@ -22,6 +22,9 @@ Meteor.methods({
22
});
23
},
24
addMessage(type: MessageType, chatId: string, content: string) {
25
+ if (!this.userId) throw new Meteor.Error('unauthorized',
26
+ 'User must be logged-in to create a new chat');
27
+
28
check(type, Match.OneOf(String, [ MessageType.TEXT ]));
29
check(chatId, nonEmptyString);
30
check(content, nonEmptyString);
@@ -36,6 +39,7 @@ Meteor.methods({
36
39
return {
37
40
messageId: Messages.collection.insert({
38
41
chatId: chatId,
42
+ senderId: this.userId,
43
content: content,
44
createdAt: new Date(),
45
type: type
0 commit comments