-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW] Audio Notification updated in sidebar #7817
[NEW] Audio Notification updated in sidebar #7817
Conversation
The word "account" was translated with "bank account"
"Port" was translated to "harbour" and other fixes
[FIX] Fix Dutch translation
[FIX] Dutch translations
…19496/Rocket.Chat into aditya19496-audio-notification-update
hey @aditya19496 nice code! I made some changes, we had a return this.find(query, { fields: { 'u._id': 1, audioNotifications: 1, audioNotificationValue: 1, desktopNotificationDuration: 1, desktopNotifications: 1, mobilePushNotifications: 1, disableNotifications: 1 } }); what do you think? |
@@ -433,6 +433,27 @@ RocketChat.settings.addGroup('General', function() { | |||
i18nDescription: 'Desktop_Notification_Durations_Description' | |||
}); | |||
|
|||
this.add('Audio_Notifications_Value', 'chime', { | |||
type: 'int', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Int or String?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String. My mistake.
} | ||
RocketChat.Notifications.notifyUser(userId, 'audioNotification', { | ||
title, | ||
text: message.msg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to send the title
and text
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well i don't know about this part. I just changed the notification -> 'audioNotification'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
client/notifications/notification.js
Outdated
const hasFocus = readMessage.isEnable(); | ||
const messageIsInOpenedRoom = openedRoomId === notification.payload.rid; | ||
|
||
fireGlobalEvent('notification', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should fire the notification
event here again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was already there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
client/notifications/notification.js
Outdated
let openedRoomId = undefined; | ||
if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName())) { | ||
openedRoomId = Session.get('openedRoom'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can always get the openedRoomId from session and compare below comparing with != null
too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was already there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
$ne: user._id | ||
} | ||
}, { | ||
username: { $in: room.usernames }, _id: { $ne: user._id } }, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix identation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -12,7 +12,7 @@ class ModelSubscriptions extends RocketChat.models._Base { | |||
this.tryEnsureIndex({ 'unread': 1 }); | |||
this.tryEnsureIndex({ 'ts': 1 }); | |||
this.tryEnsureIndex({ 'ls': 1 }); | |||
this.tryEnsureIndex({ 'audioNotification': 1 }, { sparse: 1 }); | |||
this.tryEnsureIndex({ 'audioNotifications': 1 }, { sparse: 1 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed audioNotification to 'audioNotifications' so that all will be of the same form, like 'desktopNotifications', 'mobileNotifications'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RocketChat.Migrations.add({
version: 100,
up() {
RocketChat.models.Subscriptions.update({$exists:{audioNotification:1}}, { $rename: { 'audioNotification': 'audioNotifications' } });
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry...i forgot that part i guess.
@ggazzo yes you are right about the 'disableNotification' thing. |
@RocketChat/core
Closes #7696