|
1 |
| - |
2 | 1 | Meteor.methods({
|
3 | 2 | createRequest(name, expertise = '', openingQuestion, members = [], environment) {
|
4 | 3 | const requestTitle = name;
|
@@ -47,10 +46,12 @@ Meteor.methods({
|
47 | 46 |
|
48 | 47 | if (expertise) {
|
49 | 48 | const expertiseSubscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(expertise._id, user._id);
|
50 |
| - RocketChat.models.Subscriptions.updateDesktopNotificationsById(subscription._id, expertiseSubscription.desktopNotifications); |
51 |
| - RocketChat.models.Subscriptions.updateMobilePushNotificationsById(subscription._id, expertiseSubscription.mobilePushNotifications); |
52 |
| - RocketChat.models.Subscriptions.updateEmailNotificationsById(subscription._id, expertiseSubscription.emailNotifications); |
53 |
| - RocketChat.models.Subscriptions.updateAudioNotificationsById(subscription._id, expertiseSubscription.audioNotifications); |
| 49 | + if (expertiseSubscription) { |
| 50 | + RocketChat.models.Subscriptions.updateDesktopNotificationsById(subscription._id, expertiseSubscription.desktopNotifications); |
| 51 | + RocketChat.models.Subscriptions.updateMobilePushNotificationsById(subscription._id, expertiseSubscription.mobilePushNotifications); |
| 52 | + RocketChat.models.Subscriptions.updateEmailNotificationsById(subscription._id, expertiseSubscription.emailNotifications); |
| 53 | + RocketChat.models.Subscriptions.updateAudioNotificationsById(subscription._id, expertiseSubscription.audioNotifications); |
| 54 | + } |
54 | 55 | } else {
|
55 | 56 | // Fallback: notify everything
|
56 | 57 | RocketChat.models.Subscriptions.updateDesktopNotificationsById(subscription._id, 'all');
|
@@ -81,13 +82,13 @@ Meteor.methods({
|
81 | 82 | }
|
82 | 83 | const roomCreateResult = RocketChat.createRoom('r', name, Meteor.user() && Meteor.user().username, members, false, {expertise});
|
83 | 84 | if (requestTitle) {
|
84 |
| - RocketChat.saveRoomTopic (roomCreateResult.rid, expertise, Meteor.user()); |
| 85 | + RocketChat.saveRoomTopic(roomCreateResult.rid, expertise, Meteor.user()); |
85 | 86 | }
|
86 | 87 | createNotifications(roomCreateResult.rid, members.concat([Meteor.user().username]));
|
87 | 88 | const room = RocketChat.models.Rooms.findOneById(roomCreateResult.rid);
|
88 | 89 | if (openingQuestion) {
|
89 | 90 | const msg = openingQuestion;
|
90 |
| - const msgObject = { _id: Random.id(), rid:roomCreateResult.rid, msg}; |
| 91 | + const msgObject = {_id: Random.id(), rid: roomCreateResult.rid, msg}; |
91 | 92 | RocketChat.sendMessage(Meteor.user(), msgObject, room);
|
92 | 93 | }
|
93 | 94 |
|
|
0 commit comments