@@ -25,7 +25,6 @@ export class Subscriptions extends Base {
2525 this . tryEnsureIndex ( { alert : 1 } ) ;
2626 this . tryEnsureIndex ( { ts : 1 } ) ;
2727 this . tryEnsureIndex ( { ls : 1 } ) ;
28- this . tryEnsureIndex ( { audioNotifications : 1 } , { sparse : 1 } ) ;
2928 this . tryEnsureIndex ( { desktopNotifications : 1 } , { sparse : 1 } ) ;
3029 this . tryEnsureIndex ( { mobilePushNotifications : 1 } , { sparse : 1 } ) ;
3130 this . tryEnsureIndex ( { emailNotifications : 1 } , { sparse : 1 } ) ;
@@ -146,6 +145,20 @@ export class Subscriptions extends Base {
146145 return this . update ( query , update ) ;
147146 }
148147
148+ clearAudioNotificationValueById ( _id ) {
149+ const query = {
150+ _id,
151+ } ;
152+
153+ const update = {
154+ $unset : {
155+ audioNotificationValue : 1 ,
156+ } ,
157+ } ;
158+
159+ return this . update ( query , update ) ;
160+ }
161+
149162 updateNotificationsPrefById ( _id , notificationPref , notificationField , notificationPrefOrigin ) {
150163 const query = {
151164 _id,
@@ -237,15 +250,6 @@ export class Subscriptions extends Base {
237250 this . update ( query , update ) ;
238251 }
239252
240- findAlwaysNotifyAudioUsersByRoomId ( roomId ) {
241- const query = {
242- rid : roomId ,
243- audioNotifications : 'all' ,
244- } ;
245-
246- return this . find ( query ) ;
247- }
248-
249253 findAlwaysNotifyDesktopUsersByRoomId ( roomId ) {
250254 const query = {
251255 rid : roomId ,
@@ -293,57 +297,6 @@ export class Subscriptions extends Base {
293297 return this . find ( query , { fields : { emailNotifications : 1 , u : 1 } } ) ;
294298 }
295299
296- findNotificationPreferencesByRoom ( query /* { roomId: rid, desktopFilter: desktopNotifications, mobileFilter: mobilePushNotifications, emailFilter: emailNotifications }*/ ) {
297- return this . _db . find ( query , {
298- fields : {
299-
300- // fields needed for notifications
301- rid : 1 ,
302- t : 1 ,
303- u : 1 ,
304- name : 1 ,
305- fname : 1 ,
306- code : 1 ,
307-
308- // fields to define if should send a notification
309- ignored : 1 ,
310- audioNotifications : 1 ,
311- audioNotificationValue : 1 ,
312- desktopNotifications : 1 ,
313- mobilePushNotifications : 1 ,
314- emailNotifications : 1 ,
315- disableNotifications : 1 ,
316- muteGroupMentions : 1 ,
317- userHighlights : 1 ,
318- } ,
319- } ) ;
320- }
321-
322- findAllMessagesNotificationPreferencesByRoom ( roomId ) {
323- const query = {
324- rid : roomId ,
325- 'u._id' : { $exists : true } ,
326- $or : [
327- { desktopNotifications : { $in : [ 'all' , 'mentions' ] } } ,
328- { mobilePushNotifications : { $in : [ 'all' , 'mentions' ] } } ,
329- { emailNotifications : { $in : [ 'all' , 'mentions' ] } } ,
330- ] ,
331- } ;
332-
333- return this . _db . find ( query , {
334- fields : {
335- 'u._id' : 1 ,
336- audioNotifications : 1 ,
337- audioNotificationValue : 1 ,
338- desktopNotifications : 1 ,
339- mobilePushNotifications : 1 ,
340- emailNotifications : 1 ,
341- disableNotifications : 1 ,
342- muteGroupMentions : 1 ,
343- } ,
344- } ) ;
345- }
346-
347300 resetUserE2EKey ( userId ) {
348301 this . update ( { 'u._id' : userId } , {
349302 $unset : {
0 commit comments