|
|
@ -1,6 +1,6 @@ |
|
|
|
import { Random } from 'meteor/random'; |
|
|
|
import { Random } from 'meteor/random'; |
|
|
|
|
|
|
|
|
|
|
|
import { Messages, Users, Subscriptions } from '../../../models'; |
|
|
|
import { Messages, Users, Subscriptions } from '../../../models/server'; |
|
|
|
import { Notifications } from '../../../notifications'; |
|
|
|
import { Notifications } from '../../../notifications'; |
|
|
|
import { updateMessage } from '../../../lib/server/functions/updateMessage'; |
|
|
|
import { updateMessage } from '../../../lib/server/functions/updateMessage'; |
|
|
|
import { executeSendMessage } from '../../../lib/server/methods/sendMessage'; |
|
|
|
import { executeSendMessage } from '../../../lib/server/methods/sendMessage'; |
|
|
@ -48,12 +48,15 @@ export class AppMessageBridge { |
|
|
|
|
|
|
|
|
|
|
|
const msg = this.orch.getConverters().get('messages').convertAppMessage(message); |
|
|
|
const msg = this.orch.getConverters().get('messages').convertAppMessage(message); |
|
|
|
|
|
|
|
|
|
|
|
Notifications.notifyUser(user.id, 'message', Object.assign(msg, { |
|
|
|
if (!msg) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Notifications.notifyUser(user.id, 'message', { |
|
|
|
|
|
|
|
...msg, |
|
|
|
_id: Random.id(), |
|
|
|
_id: Random.id(), |
|
|
|
ts: new Date(), |
|
|
|
ts: new Date(), |
|
|
|
u: undefined, |
|
|
|
}); |
|
|
|
editor: undefined, |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async notifyRoom(room, message, appId) { |
|
|
|
async notifyRoom(room, message, appId) { |
|
|
@ -68,8 +71,6 @@ export class AppMessageBridge { |
|
|
|
_id: Random.id(), |
|
|
|
_id: Random.id(), |
|
|
|
rid: room.id, |
|
|
|
rid: room.id, |
|
|
|
ts: new Date(), |
|
|
|
ts: new Date(), |
|
|
|
u: undefined, |
|
|
|
|
|
|
|
editor: undefined, |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const users = Subscriptions.findByRoomIdWhenUserIdExists(room.id, { fields: { 'u._id': 1 } }) |
|
|
|
const users = Subscriptions.findByRoomIdWhenUserIdExists(room.id, { fields: { 'u._id': 1 } }) |
|
|
|