Skip to content
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

Merged
merged 3 commits into from
Mar 26, 2018

Conversation

MarcosSpessatto
Copy link
Member

Added two endpoints: GET/POST channels.notifications, that returns and updates the notification settings from a specific channel. Requested in this issue.

@rafaelks
Copy link
Contributor

@MarcosSpessatto Amazing! Do you have the docs already?

@MarcosSpessatto
Copy link
Member Author

@rafaelks, docs.

return RocketChat.API.v1.failure('The \'roomId\' param is required');
}

const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId);
Copy link
Member

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'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this missing desktopNotifications?

})
.end(done);

it('/channels.leave', async(done) => {
Copy link
Member

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) => {?

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10128 March 15, 2018 20:06 Inactive
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}});
Copy link
Member

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

@rodrigok rodrigok merged commit f50679d into develop Mar 26, 2018
@rodrigok rodrigok deleted the feature/rest-channel-notifications-settings branch March 26, 2018 14:08
@rodrigok rodrigok mentioned this pull request Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants