-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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] Added GET/POST channels.notifications #10128
[NEW] Added GET/POST channels.notifications #10128
Conversation
@MarcosSpessatto Amazing! Do you have the docs already? |
return RocketChat.API.v1.failure('The \'roomId\' param is required'); | ||
} | ||
|
||
const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId); |
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.
You can remove the fields in query, that will copy the object and remove the fields, example:
RocketChat.models.Subscriptions.findOne({}, {fields: {_room: 0, _user: 0, $loki: 0}});
}; | ||
const isInvalidNotification = !Object.keys(notifications).includes(field); | ||
const basicValuesForNotifications = ['all', 'mentions', 'nothing', 'default']; | ||
const fieldsMustHaveBasicValues = ['emailNotifications', 'audioNotifications', 'mobilePushNotifications']; |
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.
Is this missing desktopNotifications
?
tests/end-to-end/api/02-channels.js
Outdated
}) | ||
.end(done); | ||
|
||
it('/channels.leave', async(done) => { |
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.
Why this it
is inside the it('POST /channels.notifications', (done) => {
?
…dation to channels.notifications
const { roomId } = this.requestParams(); | ||
|
||
if (!roomId) { | ||
return RocketChat.API.v1.failure('The \'roomId\' param is required'); | ||
} | ||
|
||
const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId); | ||
const subscription = RocketChat.models.Subscriptions.findOne({}, {fields: {_room: 0, _user: 0, $loki: 0}}); |
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.
Wrong find, please revert to the old one
Added two endpoints: GET/POST channels.notifications, that returns and updates the notification settings from a specific channel. Requested in this issue.